提交 6f28049a 编写于 作者: J Jared Parsons

Merge pull request #4063 from jaredpar/fixes

Test for structs in using in async method
...@@ -3288,6 +3288,43 @@ .maxstack 3 ...@@ -3288,6 +3288,43 @@ .maxstack 3
sequencePoints: "Test+<F>d__2.MoveNext"); sequencePoints: "Test+<F>d__2.MoveNext");
} }
[Fact]
public void MutatingStructWithUsing()
{
var source =
@"using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
class Program
{
public static void Main()
{
(new Program()).Test().Wait();
}
public async Task Test()
{
var list = new List<int> {1, 2, 3};
using (var enumerator = list.GetEnumerator())
{
Console.WriteLine(enumerator.MoveNext());
Console.WriteLine(enumerator.Current);
await Task.Delay(1);
}
}
}";
var expectedOutput = @"True
1";
var comp = CreateCompilation(source, options: TestOptions.DebugExe);
CompileAndVerify(comp, expectedOutput: expectedOutput);
}
[Fact, WorkItem(1942, "https://github.com/dotnet/roslyn/issues/1942")] [Fact, WorkItem(1942, "https://github.com/dotnet/roslyn/issues/1942")]
public void HoistStructure() public void HoistStructure()
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册