-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generator crashes if [CreateSyncVersion]
is applied to overloads
#3
Comments
I agree, there shouldn't be a crash and this case should return proper diagnostics message. I'd say that overloads should be supported as long as they don't converge to same parameter list as in the example above. |
da4385d fixes the overload crash. Diagnostics is still on the todo list, but this should allow anyone to move forward. |
When I look at the unit test and snapshots in da4385d, then something is off. First, the two generated files, ending in [CreateSyncVersion]
Task ReadAsMemoryAsync(Stream stream, byte[] sampleBytes)
=> ReadAsMemoryAsync(stream, sampleBytes, CancellationToken.None);
[CreateSyncVersion]
async Task ReadAsMemoryAsync(Stream stream, byte[] sampleBytes, CancellationToken ct)
=> await stream.ReadAsync(sampleBytes.AsMemory(0, 123), ct).ConfigureAwait(false); Note that the first overload doesn't need any |
Both of them got picked up, but they got reduced to the same thing. This would cause compilation issue, so this test case will be spitting out a warning or error in the future.
Yeah, will definitely provide better diagnostics for that exact scenario. The crash was affecting all overloads, even with completely different parameters, so I wanted to get that out of the way first. |
Understood. Happy then if you want to close this issue as done since the generator doesn't crash anymore. |
I'll keep it open just so that I don't need to create a new issue and fix it in the next few days. Also wanted to confirm that this issue isn't a showstopper for you if you decided to integrate this library into moreLINQ. |
No blocker at the moment as I am still very early in the evaluation phase, but one big plus has been all your prompt support! I might continue with a bigger spike when I have time next and would be happy to report issues if you're interested? |
Very interested, thanks! |
Suppose the following (taken from tests):
Suppose further that the developer wants to offer another overload of
HalfCheckSumAsync
without thect
parameter:Upon compilation, the following warning is emitted:
You could say that the overload doesn't need
[CreateSyncVersion]
because it just delegates the implementation, but the generator should emit a diagnostic rather than crashing.I also wonder what are you thoughts on overloads, whether those should be supported by-design or not.
The text was updated successfully, but these errors were encountered: