-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Async-streams: minimal test for IOperation and CFG. Improve diagnostics #30363
Conversation
8b787ef
to
a315820
Compare
366c16c
to
d993252
Compare
@dotnet/roslyn-compiler for review. Adding some tests to capture current IOperation/CFG behavior, and improving a diagnostic. Thanks #Closed |
src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IForEachLoopStatement.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (iteration 4)
Re-targeted to preview2 branch. #Closed |
TypeSymbol declType = declarations[0].DeclaredType.Type; | ||
|
||
if (declType.IsDynamic()) | ||
if (declarationTypeOpt.IsDynamic()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
declarationTypeOpt [](start = 20, length = 18)
If this is optional, consider ?.
instead. If it is not optional, consider renaming. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's optional in the method, but it's always set in this branch, so I don't see a great way. I could have an extra local for the branch, but that seems overkill :-(
In reply to: 232006228 [](ancestors = 232006228)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | ||
HashSet<DiagnosticInfo> useSiteDiagnostics = null; | ||
|
||
iDisposableConversion = fromExpression ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could consider extracting this expression into a local function. #Closed
@@ -2959,9 +2959,15 @@ A catch() block after a catch (System.Exception e) block can catch non-CLS excep | |||
<data name="ERR_NoConvToIDisp" xml:space="preserve"> | |||
<value>'{0}': type used in a using statement must be implicitly convertible to 'System.IDisposable'</value> | |||
</data> | |||
<data name="ERR_NoConvToIDispWrongAsync" xml:space="preserve"> | |||
<value>'{0}': type used in a using statement must be implicitly convertible to 'System.IDisposable'. Did you mean 'await using'?</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: use the same end to the error message for both of these. #Closed
} | ||
} | ||
"; | ||
// https://github.com/dotnet/roslyn/issues/30362 how do we flag `await`? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
We'll have to follow-up with IOperation design team. IAwaitOperation is currently meant for expressions.
I'm not sure that we want to represent an await foreach ...
as an IAwaitOperation containing an IForEachLoopOperation. It is a bit odd to apply IAwaitOperation to a statement and have it modify the semantics of that statement.
Rather, I expect we would have a new node (IAwaitForEachLoopOperation?), or maybe a flag on IForEachLoopOperation.
In reply to: 232009689 [](ancestors = 232009689)
VerifyFlowGraphAndDiagnosticsForTest<BlockSyntax>(source + s_IAsyncEnumerable + s_ValueTask, expectedFlowGraph, expectedDiagnostics); | ||
} | ||
|
||
private static string s_ValueTask = @" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something we should consider putting in CSharpTestBase? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hesitate to do that because it is a non-functional implementation.
In reply to: 232010093 [](ancestors = 232010093)
Done review pass (commit 8) #Closed |
test this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (commit 9)
approved |
…out-if-error-message * origin/master: (174 commits) Add Compilers filter for Roslyn (dotnet#30880) Remove NonNullTypes context and other unnecessary information stored in TypeSymbolWithAnnotations. (dotnet#30913) Update BoundCall method based on receiver nullability (dotnet#31000) Make nullabiulity inference associative and commutative (dotnet#30990) Async-streams: minimal test for IOperation and CFG. Improve diagnostics (dotnet#30363) Add src. Add test. Remove dead code Update the build status table Script for generating our build status tables Add parsing tests to compiler benchmarks (dotnet#31033) Fix Edit and Continue in CPS projects Add comment Sorting. Save work Address PR feedback only produce optprof data on an official build Add bunch of exclusions to dead code analysis for special methods Disable WinRT tests on Linux (dotnet#31026) Change prerelease version to beta2 (dotnet#31017) ... # Conflicts: # src/Compilers/CSharp/Portable/CSharpResources.resx # src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
foreach
, asyncusing
or async-iterator method. Opened follow-up issue for proper design/implementation (Finalize design and implementation of IOperation and CFG for async-streams feature #30362)using
and asyncusing