Skip to content

Commit

Permalink
Add repro
Browse files Browse the repository at this point in the history
  • Loading branch information
RikkiGibson authored and alrz committed Feb 26, 2024
1 parent 1c24d15 commit 2a6d538
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6053,5 +6053,36 @@ public async Task M(object o)
var comp = CSharpTestBase.CreateCompilation(source);
comp.VerifyEmitDiagnostics();
}

[ConditionalFact(typeof(CoreClrOnly))]
public void Repro()
{
var source = """
using System;
using System.Threading.Tasks;
using System.Collections.Immutable;

await M(ImmutableArray.Create("a"));
Console.Write(1);

public partial class Program
{
public static void M1(bool b) { }

public static async Task M(ImmutableArray<string> a)
{
foreach (var i in a)
{
M1(i.Length is 10 or 20 or 30);
await Task.Delay(1).ConfigureAwait(false);
}
}
}
""";

// TODO2: ImmutableArray is only available when we specify a targetFramework
var comp = CompileAndVerify(source, expectedOutput: "1", options: TestOptions.ReleaseExe, targetFramework: TargetFramework.NetCoreApp);
comp.VerifyDiagnostics();
}
}
}

0 comments on commit 2a6d538

Please sign in to comment.