roslyn
roslyn copied to clipboard
Test plan for "ref and unsafe in iterators and async" feature
Speclet: https://github.com/dotnet/csharplang/blob/main/proposals/ref-unsafe-in-iterators-async.md Feature branch: https://github.com/dotnet/roslyn/tree/features/RefInAsync Label: https://github.com/dotnet/roslyn/labels/New%20Feature%20-%20Ref%2FUnsafe%20in%20Iterators%2FAsync
- [ ] Review feature specification at LDM
- [x] Breaking change around
unsafe
context within iterators is documented - [ ] language version
- [ ]
ref
/ref struct
local in- [x]
async
method - [ ] iterator method
- [x]
- [ ]
unsafe
block is allowed in C# 13 in- [ ]
async
method (this is a preserved legacy behavior) - [x] iterator method
- [ ]
- [x]
unsafe
modifier is allowed on an iterator in C# 13, still an error (a language version error) in previous versions- [x] regular method
- [x] property get
- [x] local function
- [x] operator
- [ ] effect on
unsafe
context within iterator's body (the breaking change)- [x] regular method
- [ ] property get
- [x] local function
- [ ] operator
- [ ]
- [ ] use
ref
/ref struct
local- [ ] within / across
await
- [ ] within / across
yield return;
in- [ ] regular iterators
- [ ]
async
iterators
- [ ] across
yield break;
in- [ ] regular iterators
- [ ]
async
iterators
- [ ] within / across
async foreach
block - [ ]
yield
in nested block - [ ] within
async
lambda / local function - [ ] within iterator local function
- [ ] within property / indexer
get
iterator - [ ] error in
async
/ iterator even inunsafe
context - [ ] await in elements of stackalloc, the result span should be usable afterwards
- [ ]
async Task<int[]> M() => ... ReadOnlySpan<int> x = await M();
is expected to work - [ ]
Buffer2<int> b = [await a, await b]; // inline array type (ref struct)
- [ ]
using (refStruct = ...) { await ...; }
- [ ]
foreach (var _ in refStruct) { await ...; }
- [ ] Interpolation handlers with awaits in the middle handler is a ref struct
- [ ] no awaits in async method should work
- [ ] Has await should be blocked
- [ ] within / across
- [x]
unsafe
context- [x] unannotated /
unsafe
containing type - [x] unannotated /
unsafe
iterator method declaration - [x] unannotated /
unsafe
iterator block - [x] unannotated /
unsafe
local function - [x] unannotated lambda
- [x] unannotated /
unsafe
property - [x] unannotated /
unsafe
property / indexerget
iterator
- [x] unannotated /
- [ ] within
unsafe
context- [ ] error for
await
(confirm we have a legacy test) - [x] error for
yield return;
- [x] no diagnostic for
yield break;
- [ ] error for
- [x] within
lock
- [x] next warning waive warning for
yield return;
for legacy lock - [x] error for
yield return;
forLock
type - [x] no diagnostic for
yield break;
- [x] next warning waive warning for
- [x] taking address of local / parameter
- [x] error in iterator method
- [x] error in iterator method for an indirect case
- [x] warning in
async
method (C#12 warning wave)
- [x] taking address of a field is allowed in
async
/iterator
Related:
- https://github.com/dotnet/csharplang/issues/1331