Test plan for enhanced using and foreach #28588
Labels
Area-Compilers
Test
Test failures in roslyn-CI
Test-Gap
Describes a specific feature or scenario that does not have test coverage
Milestone
csharplang
.Feature List
Features
using
declaration Champion "Implicitly scoped using statement" (16.3, Core 3) csharplang#1174using
forref struct
Proposal: Allowusing
statement to structurally matchIDisposable
on ref structs (16.3, Core 3) csharplang#1623Code Examples
Using declarations
Pattern based using for
ref struct
Compiler Secnarios
using
declarationGoto can't jump over a
using
declaration unless it also jumps over the closing bracegoto backwards over a
using
declaration must also cross the opening bracegoto can jump around inside a block when it doesn't cross
using
declarationref struct
foreach
block (both classic andawait foreach
)ref struct
respects the lifetime of the initializerusing
declaration restrictionsref
andref readonly
in ausing
declarationconst
:using const ...
(should be binding error),const using ...
(parsing error?)using MyDisposable local;
IDisposable
type (see uses ofCompilation.MakeTypeMissing(WellKnownType)
API)IAsyncDisposable
type.await using
declaration only legal inasync
method.dynamic
is allowedusing
declaration usage casesnull
/default
valueref
orout
.struct
variable asref readonly
orin
finally
executed)using
declarationDispose()
method should work if it returnsTask
orValueTask
(task-like)DisposeAsync()
AwaitUsingAndForeachAddsPendingBranch
flag (context)Task? DisposeAsync()
method inawait using
(declaration or statement). Should produce a null warningyield return
in betweenusing
or inforeach
Productivity
Dispose
referenced inusing
andforeach
statements #28228)Dispose
method usage inusing
declarationDispose
/AsyncDispose
method usage inforeach
statementsusing
declaration variable (replaced by issue InlineVariable should not trigger for ausing
declaration #35645)using
declaration (replaced by issue Extract Method should understandusing
declarations #35646)foreach
wrapping the containing scope in a finally block. We need to be careful where to place the sequence point that is
currently emitted for ‘}’ of such scope. EnC is especially concerned about all exception handling blocks and needs
to be aware of them.)
MakeMethodAsync
on using-declaration.await using
orusing
) depending on the kind of disposableOpen LDM Issues
await using var x = ...
)?x.Dispose()
would call it,GetPinnableReference()
for fixed doesn't)using var
(you can't jump into a using statement today as the scope is different)Proposal: dotnet/csharplang#1703
Championed issue (with LDM history): dotnet/csharplang#1174
The text was updated successfully, but these errors were encountered: