Move reporting of ERR_IteratorMustBeAsync to avoid race condition#39990
Move reporting of ERR_IteratorMustBeAsync to avoid race condition#39990jcouv merged 7 commits intodotnet:masterfrom
Conversation
| } | ||
| else if (asyncInterface && !_methodSymbol.IsAsync) | ||
| { | ||
| Error(elementTypeDiagnostics, ErrorCode.ERR_IteratorMustBeAsync, errorLocation, _methodSymbol, returnType); |
There was a problem hiding this comment.
Error(elementTypeDiagnostics, ErrorCode.ERR_IteratorMustBeAsync, errorLocation, _methodSymbol, returnType); [](start = 20, length = 107)
Can we get into similar trouble with errors reported above? #Closed
There was a problem hiding this comment.
I think so, yes. #39992 is indeed similar. I'll address in this PR. Thanks! #Resolved
|
Could you please check if #39992 is the same/similar issue? #Closed |
| // public IEnumerator GetEnumerator() | ||
| Diagnostic(ErrorCode.ERR_ReturnExpected, "GetEnumerator").WithArguments("C.GetEnumerator()") | ||
| ); | ||
| comp.GetEmitDiagnostics(); |
There was a problem hiding this comment.
GetEmitDiagnostics [](start = 17, length = 18)
VerifyEmitDiagnostics? #Closed
It looks like this parameter is no longer used. #Closed Refers to: src/Compilers/CSharp/Portable/Binder/InMethodBinder.cs:127 in 10d359f. [](commit_id = 10d359f, deletion_comment = False) |
| // static System.Collections.Generic.IAsyncEnumerable<int> M() | ||
| Diagnostic(ErrorCode.ERR_IteratorMustBeAsync, "M").WithArguments("C.M()", "System.Collections.Generic.IAsyncEnumerable<int>").WithLocation(4, 61) | ||
| ); | ||
| comp.GetEmitDiagnostics(); |
There was a problem hiding this comment.
GetEmitDiagnostics [](start = 17, length = 18)
VerifyEmitDiagnostics? #Closed
| } | ||
| }"; | ||
| var compilation = CreateCompilation(text); | ||
| compilation.GetDiagnostics(); |
There was a problem hiding this comment.
GetDiagnostics [](start = 24, length = 14)
Verify? #Closed
| }"; | ||
| var compilation = CreateCompilation(text); | ||
| compilation.GetDiagnostics(); | ||
| compilation.GetEmitDiagnostics(); |
There was a problem hiding this comment.
GetEmitDiagnostics [](start = 24, length = 18)
Verify? #Closed
| } | ||
| }"; | ||
| var compilation = CreateCompilation(text); | ||
| compilation.GetDiagnostics(); |
There was a problem hiding this comment.
compilation.GetDiagnostics(); [](start = 12, length = 29)
Instead of modifying this particular unit-test, consider creating a new one. It looks like the original test is targeting specific sequence of API calls. #Closed
| @@ -23,15 +23,13 @@ internal sealed class InMethodBinder : LocalScopeBinder | |||
|
|
|||
| private class IteratorInfo | |||
There was a problem hiding this comment.
IteratorInfo [](start = 22, length = 12)
Can we use TypeWithAnnotations.Boxed instead of this class now? #Closed
It's used in the override in In reply to: 558375087 [](ancestors = 558375087) Refers to: src/Compilers/CSharp/Portable/Binder/InMethodBinder.cs:127 in 10d359f. [](commit_id = 10d359f, deletion_comment = False) |
Would it make sense to move reporting of In reply to: 558389580 [](ancestors = 558389580,558375087) Refers to: src/Compilers/CSharp/Portable/Binder/InMethodBinder.cs:127 in 10d359f. [](commit_id = 10d359f, deletion_comment = False) |
It feels like we can get rid of this parameter as well. #Closed Refers to: src/Compilers/CSharp/Portable/Binder/InMethodBinder.cs:127 in 10d359f. [](commit_id = 10d359f, deletion_comment = False) |
|
Done with review pass (iteration 3) #Closed |
| /// <summary> | ||
| /// A binder for a method body, which places the method's parameters in scope | ||
| /// and notes if the method is an iterator method. | ||
| /// Note: instances of this type can be re-used across different attempts at compiling the same method (caching by binder factory). |
There was a problem hiding this comment.
Note [](start = 8, length = 4)
📝 I didn't find any other diagnostics stored in this binder.
|
|
||
| GetIteratorElementType(node, diagnostics); | ||
| ValidateYield(node, diagnostics); | ||
| GetIteratorElementType(); |
There was a problem hiding this comment.
GetIteratorElementType(); [](start = 12, length = 25)
It looks like this call is not necessary now. #Closed
…ointers * dotnet/master: (197 commits) Update dependencies from https://github.com/dotnet/arcade build 20191201.1 (dotnet#40084) Update list of C# Next features and reviewers (dotnet#39987) Update dependencies from https://github.com/dotnet/arcade build 20191130.1 (dotnet#40075) [master] Update dependencies from dotnet/arcade (dotnet#40065) Update dependencies from https://github.com/dotnet/arcade build 20191127.4 (dotnet#40057) Added more tests & fixed minor bug Deterministic ordering + added tests back Update dependencies from https://github.com/dotnet/arcade build 20191126.2 (dotnet#40036) removed a test due to random order generation Always restore when running a bootstrap build (dotnet#40025) fixed integration test capitalization for extract method and extract interface Fix tests pt2 DiagnosticIncrementalAnalyzer refactoring (dotnet#39956) Persistence is always available in OOP Update src/Workspaces/Core/Portable/SolutionSize/SolutionSizeTracker.cs Fixed tests Move reporting of iterator diagnostics to avoid race condition (dotnet#39990) Update dependencies from https://github.com/dotnet/arcade build 20191125.7 (dotnet#40020) Fix NGEN priority of csc.exe, vbc.exe, csi.exe (dotnet#40016) Accidentally deleted something ...
Fixes #39970
Fixes #39992