Skip to content

Commit 0ad494b

Browse files
authored
[RuntimeAsync] Remove no longer needed workarounds for Roslyn NYIs (#120895)
Async methods in structs can compile and work correctly now. This is a test-only change that removes workarounds.
1 parent 65ee8fb commit 0ad494b

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/tests/async/struct/struct.cs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,22 @@ private struct S
4747

4848
public async Task Test()
4949
{
50-
// TODO: C# compiler is expected to do this, but not in the prototype.
51-
S @this = this;
50+
AssertEqual(100, this.Value);
51+
this.Value++;
52+
await this.InstanceCall();
53+
AssertEqual(101, this.Value);
5254

53-
AssertEqual(100, @this.Value);
54-
@this.Value++;
55-
await @this.InstanceCall();
56-
AssertEqual(101, @this.Value);
57-
58-
await @this.TaskButNotAsync();
59-
AssertEqual(102, @this.Value);
55+
await this.TaskButNotAsync();
56+
AssertEqual(102, this.Value);
6057
}
6158

6259
private async Task InstanceCall()
6360
{
64-
// TODO: C# compiler is expected to do this, but not in the prototype.
65-
S @this = this;
66-
67-
AssertEqual(101, @this.Value);
68-
@this.Value++;
69-
AssertEqual(102, @this.Value);
61+
AssertEqual(101, this.Value);
62+
this.Value++;
63+
AssertEqual(102, this.Value);
7064
await Task.Yield();
71-
AssertEqual(102, @this.Value);
65+
AssertEqual(102, this.Value);
7266
}
7367

7468
private Task TaskButNotAsync()

0 commit comments

Comments
 (0)