diff --git a/eng/Directory.Packages.props b/eng/Directory.Packages.props
index 83527e73dff5e..051219e96d8b6 100644
--- a/eng/Directory.Packages.props
+++ b/eng/Directory.Packages.props
@@ -182,7 +182,6 @@
-
diff --git a/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs b/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
index beb952e6d23e3..0220868d1d034 100644
--- a/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
+++ b/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
@@ -4341,7 +4341,7 @@ public void AppConfigBasic()
");
var silverlight = Temp.CreateFile().WriteAllBytes(ProprietaryTestResources.silverlight_v5_0_5_0.System_v5_0_5_0_silverlight).Path;
- var net4_0dll = Temp.CreateFile().WriteAllBytes(ResourcesNet451.System).Path;
+ var net4_0dll = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).Path;
// Test linking two appconfig dlls with simple src
var outWriter = new StringWriter(CultureInfo.InvariantCulture);
@@ -6310,7 +6310,7 @@ public class CS1698_a {}
[ConditionalFact(typeof(ClrOnly), Reason = "https://github.com/dotnet/roslyn/issues/30926")]
public void BinaryFileErrorTest()
{
- var binaryPath = Temp.CreateFile().WriteAllBytes(ResourcesNet451.mscorlib).Path;
+ var binaryPath = Temp.CreateFile().WriteAllBytes(Net461.Resources.mscorlib).Path;
var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/nologo", "/preferreduilang:en", binaryPath });
var outWriter = new StringWriter(CultureInfo.InvariantCulture);
int exitCode = csc.Run(outWriter);
diff --git a/src/Compilers/CSharp/Test/CommandLine/TouchedFileLoggingTests.cs b/src/Compilers/CSharp/Test/CommandLine/TouchedFileLoggingTests.cs
index fdf9cb0b5c099..3b6ac48e9c59d 100644
--- a/src/Compilers/CSharp/Test/CommandLine/TouchedFileLoggingTests.cs
+++ b/src/Compilers/CSharp/Test/CommandLine/TouchedFileLoggingTests.cs
@@ -10,6 +10,7 @@
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
+using Basic.Reference.Assemblies;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Resources.Proprietary;
using Microsoft.CodeAnalysis.Test.Utilities;
@@ -78,7 +79,7 @@ public void AppConfigCsc()
").Path;
var silverlight = Temp.CreateFile().WriteAllBytes(ProprietaryTestResources.silverlight_v5_0_5_0.System_v5_0_5_0_silverlight).Path;
- var net4_0dll = Temp.CreateFile().WriteAllBytes(ResourcesNet451.System).Path;
+ var net4_0dll = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).Path;
var outWriter = new StringWriter(CultureInfo.InvariantCulture);
var cmd = CreateCSharpCompiler(
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncLocalsTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncLocalsTests.cs
index 9f35f02b9440e..caaf685ab21be 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncLocalsTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncLocalsTests.cs
@@ -958,8 +958,8 @@ public static void Main()
Run();
}
}";
- var reference = CreateCompilationWithMscorlib45(source, references: new MetadataReference[] { SystemRef_v4_0_30319_17929 }).EmitToImageReference();
- var comp = CreateCompilationWithMscorlib45("", new[] { reference }, options: TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.Internal));
+ var reference = CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { SystemRef_v4_0_30319_17929 }).EmitToImageReference();
+ var comp = CreateCompilationWithMscorlib461("", new[] { reference }, options: TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.Internal));
var testClass = comp.GlobalNamespace.GetMember("Test");
var stateMachineClass = (NamedTypeSymbol)testClass.GetMembers().Single(s => s.Name.StartsWith("", StringComparison.Ordinal));
IEnumerable> spillFieldsByType = stateMachineClass.GetMembers().Where(m => m.Kind == SymbolKind.Field && m.Name.StartsWith("<>7__wrap", StringComparison.Ordinal)).Cast().GroupBy(x => x.Type);
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncMainTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncMainTests.cs
index 9352974a34fb8..a822b9665647e 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncMainTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncMainTests.cs
@@ -366,7 +366,7 @@ public struct Int32{}
namespace System.Threading.Tasks {
public class Task{}
}";
- var taskCompilation = CreateCompilationWithMscorlib45(taskAssembly, options: TestOptions.DebugDll);
+ var taskCompilation = CreateCompilationWithMscorlib461(taskAssembly, options: TestOptions.DebugDll);
taskCompilation.VerifyDiagnostics();
var source = @"
@@ -406,7 +406,7 @@ public class Object {}
namespace System.Threading.Tasks {
public class Task{}
}";
- var taskCompilation = CreateCompilationWithMscorlib45(taskAssembly, options: TestOptions.DebugDll);
+ var taskCompilation = CreateCompilationWithMscorlib461(taskAssembly, options: TestOptions.DebugDll);
taskCompilation.VerifyDiagnostics();
var source = @"
@@ -446,7 +446,7 @@ static async Task Main() {
Console.Write(""async main"");
}
}";
- var c = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var c = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
var verifier = CompileAndVerify(c, expectedOutput: "hello async main", expectedReturnCode: 0);
}
@@ -464,7 +464,7 @@ static async Task Main() {
Console.WriteLine(""async main"");
}
}";
- var c = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var c = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
c.VerifyEmitDiagnostics(
// (6,28): error CS0161: 'Program.Main()': not all code paths return a value
// static async Task Main() {
@@ -486,7 +486,7 @@ static async Task Main(string[] args) {
return 10;
}
}";
- var c = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var c = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
var verifier = CompileAndVerify(c, expectedOutput: "hello async main", expectedReturnCode: 10);
}
@@ -505,7 +505,7 @@ static async Task Main(params string[] args) {
return 10;
}
}";
- var c = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var c = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
var verifier = CompileAndVerify(c, expectedOutput: "hello async main", expectedReturnCode: 10);
}
@@ -523,7 +523,7 @@ static async Task Main(string[] args) {
Console.Write(""async main"");
}
}";
- var c = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var c = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
var verifier = CompileAndVerify(c, expectedOutput: "hello async main", expectedReturnCode: 0);
}
@@ -541,7 +541,7 @@ static async Task Main(string[] args) {
Console.WriteLine(""async main"");
}
}";
- var c = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var c = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
c.VerifyEmitDiagnostics(
// (6,28): error CS0161: 'Program.Main()': not all code paths return a value
// static async Task Main() {
@@ -563,7 +563,7 @@ static async Task Main(string[] args) {
return 10;
}
}";
- var c = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var c = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
var verifier = CompileAndVerify(c, expectedOutput: "hello async main", expectedReturnCode: 10, args: new string[] { "async main" });
}
@@ -581,7 +581,7 @@ static async Task Main(string[] args) {
Console.Write(args[0]);
}
}";
- var c = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var c = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
var verifier = CompileAndVerify(c, expectedOutput: "hello async main", expectedReturnCode: 0, args: new string[] { "async main" });
}
@@ -598,7 +598,7 @@ async static Task Main(string[] args)
await Task.Factory.StartNew(() => { });
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
compilation.VerifyDiagnostics();
var entry = compilation.GetEntryPoint(CancellationToken.None);
Assert.NotNull(entry);
@@ -620,7 +620,7 @@ static Task Main(string[] args)
return Task.Factory.StartNew(() => { });
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
compilation.VerifyDiagnostics();
var entry = compilation.GetEntryPoint(CancellationToken.None);
Assert.NotNull(entry);
@@ -642,7 +642,7 @@ static ref Task Main(string[] args)
throw new System.Exception();
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
compilation.VerifyDiagnostics(
// (6,21): warning CS0028: 'A.Main(string[])' has the wrong signature to be an entry point
// static ref Task Main(string[] args)
@@ -664,7 +664,7 @@ async static Task Main(string[] args)
await Task.Factory.StartNew(() => { });
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
compilation.VerifyDiagnostics(
// (6,18): error CS8107: Feature 'async main' is not available in C# 7.0. Please use language version 7.1 or greater.
// async static Task Main(string[] args)
@@ -687,7 +687,7 @@ static Task Main(string[] args)
return Task.Factory.StartNew(() => { });
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
compilation.VerifyDiagnostics(
// (6,18): error CS8107: Feature 'async main' is not available in C# 7. Please use language version 7.1 or greater.
// async static Task Main(string[] args)
@@ -709,7 +709,7 @@ async static Task Main()
await Task.Factory.StartNew(() => { });
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
compilation.VerifyDiagnostics();
var entry = compilation.GetEntryPoint(CancellationToken.None);
Assert.NotNull(entry);
@@ -786,7 +786,7 @@ static Task Main()
return Task.Factory.StartNew(() => { });
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
compilation.VerifyDiagnostics();
var entry = compilation.GetEntryPoint(CancellationToken.None);
Assert.NotNull(entry);
@@ -806,7 +806,7 @@ async static void Main()
await Task.Factory.StartNew(() => { });
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
compilation.VerifyDiagnostics(
// (6,23): error CS8413: Async Main methods must return Task or Task
// async static void Main()
@@ -828,7 +828,7 @@ async static int Main()
return await Task.Factory.StartNew(() => 5);
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
compilation.VerifyDiagnostics(
// (6,22): error CS1983: The return type of an async method must be void, Task or Task
// async static int Main()
@@ -855,7 +855,7 @@ async static int Main()
return await Task.Factory.StartNew(() => 5);
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
compilation.VerifyDiagnostics(
// (6,22): error CS1983: The return type of an async method must be void, Task or Task
// async static int Main()
@@ -880,7 +880,7 @@ async static Task Main(string[] args)
return await Task.Factory.StartNew(() => 5);
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
compilation.VerifyDiagnostics();
var entry = compilation.GetEntryPoint(CancellationToken.None);
Assert.NotNull(entry);
@@ -900,7 +900,7 @@ static Task Main(string[] args)
return Task.Factory.StartNew(() => 5);
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
compilation.VerifyDiagnostics();
var entry = compilation.GetEntryPoint(CancellationToken.None);
Assert.NotNull(entry);
@@ -920,7 +920,7 @@ async static Task Main(string[] args)
return await Task.Factory.StartNew(() => 5);
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
compilation.VerifyDiagnostics(
// (6,18): error CS8107: Feature 'async main' is not available in C# 7. Please use language version 7.1 or greater.
// async static Task Main(string[] args)
@@ -942,7 +942,7 @@ static Task Main(string[] args)
return Task.Factory.StartNew(() => 5);
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
compilation.VerifyDiagnostics(
// (6,18): error CS8107: Feature 'async main' is not available in C# 7. Please use language version 7.1 or greater.
// async static Task Main(string[] args)
@@ -964,7 +964,7 @@ async static Task Main()
return await Task.Factory.StartNew(() => 5);
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
compilation.VerifyDiagnostics();
var entry = compilation.GetEntryPoint(CancellationToken.None);
Assert.NotNull(entry);
@@ -984,7 +984,7 @@ static Task Main()
return Task.Factory.StartNew(() => 5);
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
compilation.VerifyDiagnostics();
var entry = compilation.GetEntryPoint(CancellationToken.None);
Assert.NotNull(entry);
@@ -1004,7 +1004,7 @@ async static Task Main()
return await Task.Factory.StartNew(() => 5);
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
compilation.VerifyDiagnostics(
// (6,18): error CS8107: Feature 'async main' is not available in C# 7. Please use language version 7.1 or greater.
// async static Task Main()
@@ -1026,7 +1026,7 @@ static Task Main()
return Task.Factory.StartNew(() => 5);
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7));
compilation.VerifyDiagnostics(
// (6,18): error CS8107: Feature 'async main' is not available in C# 7. Please use language version 7.1 or greater.
// async static Task Main()
@@ -1049,7 +1049,7 @@ async static Task Main()
return 0;
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1));
compilation.VerifyDiagnostics(
// (6,30): warning CS0028: 'A.Main()' has the wrong signature to be an entry point
// async static Task Main()
@@ -1071,7 +1071,7 @@ async static void Main()
await Task.Factory.StartNew(() => { });
}
}";
- CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1)).VerifyDiagnostics(
+ CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1)).VerifyDiagnostics(
// (6,23): warning CS0402: 'A.Main()': an entry point cannot be generic or in a generic type
// async static void Main()
Diagnostic(ErrorCode.WRN_MainCantBeGeneric, "Main").WithArguments("A.Main()").WithLocation(6, 23),
@@ -1092,7 +1092,7 @@ async static void Main(bool truth)
await Task.Factory.StartNew(() => { });
}
}";
- CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+ CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,23): warning CS0028: 'A.Main(bool)' has the wrong signature to be an entry point
// async static void Main(bool truth)
Diagnostic(ErrorCode.WRN_InvalidMainSig, "Main").WithArguments("A.Main(bool)").WithLocation(6, 23),
@@ -1113,7 +1113,7 @@ async static void Main(bool truth)
await Task.Factory.StartNew(() => { });
}
}";
- CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+ CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (6,23): warning CS0028: 'A.Main(bool)' has the wrong signature to be an entry point
// async static void Main(bool truth)
Diagnostic(ErrorCode.WRN_InvalidMainSig, "Main").WithArguments("A.Main(bool)").WithLocation(6, 23),
@@ -1139,7 +1139,7 @@ async static Task Main(string[] args)
System.Console.WriteLine(""Task Main"");
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7)).VerifyDiagnostics();
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7)).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "Non Task Main", expectedReturnCode: 0);
}
@@ -1161,7 +1161,7 @@ async static Task Main(string[] args)
System.Console.WriteLine(""Task Main"");
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1)).VerifyDiagnostics(
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1)).VerifyDiagnostics(
// (10,23): warning CS8892: Method 'A.Main(string[])' will not be used as an entry point because a synchronous entry point 'A.Main()' was found.
// async static Task Main(string[] args)
Diagnostic(ErrorCode.WRN_SyncAndAsyncEntryPoints, "Main").WithArguments("A.Main(string[])", "A.Main()").WithLocation(10, 23)
@@ -1189,7 +1189,7 @@ async static int Main()
return 1;
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (11,22): error CS1983: The return type of an async method must be void, Task or Task
// async static int Main()
Diagnostic(ErrorCode.ERR_BadAsyncReturn, "Main").WithLocation(11, 22),
@@ -1217,7 +1217,7 @@ static async void Main(string[] args)
System.Console.WriteLine(""Async Void Main"");
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1)).VerifyDiagnostics(
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1)).VerifyDiagnostics(
// (6,23): error CS4009: A void or int returning entry point cannot be async
// static async void Main(string[] args)
Diagnostic(ErrorCode.ERR_NonTaskMainCantBeAsync, "Main").WithLocation(6, 23),
@@ -1243,7 +1243,7 @@ async static Task Main(string[] args)
System.Console.WriteLine(""Task Main"");
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe.WithMainTypeName("A")).VerifyDiagnostics(
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe.WithMainTypeName("A")).VerifyDiagnostics(
// (10,23): warning CS8892: Method 'A.Main(string[])' will not be used as an entry point because a synchronous entry point 'A.Main()' was found.
// async static Task Main(string[] args)
Diagnostic(ErrorCode.WRN_SyncAndAsyncEntryPoints, "Main").WithArguments("A.Main(string[])", "A.Main()").WithLocation(10, 23));
@@ -1270,7 +1270,7 @@ async static Task Main(string[] args)
return 0.0F;
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseDebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7)).VerifyDiagnostics(
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseDebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7)).VerifyDiagnostics(
// (6,28): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
// async static Task Main()
Diagnostic(ErrorCode.WRN_AsyncLacksAwaits, "Main").WithLocation(6, 28),
@@ -1307,7 +1307,7 @@ static Task Main(string[] args)
return Task.FromResult(0.0F);
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseDebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7)).VerifyDiagnostics(
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseDebugExe, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7)).VerifyDiagnostics(
// (6,12): error CS8107: Feature 'async main' is not available in C# 7. Please use language version 7.1 or greater.
// static Task Main()
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion7, "Task").WithArguments("async main", "7.1").WithLocation(6, 12),
@@ -1338,7 +1338,7 @@ async static Task Main(string[] args)
return 0.0f;
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe).VerifyDiagnostics(
// (10,30): warning CS0028: 'A.Main(string[])' has the wrong signature to be an entry point
// async static Task Main(string[] args)
Diagnostic(ErrorCode.WRN_InvalidMainSig, "Main").WithArguments("A.Main(string[])").WithLocation(11, 30));
@@ -1365,7 +1365,7 @@ async static Task Main(string[] args)
return 0.0f;
}
}";
- var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe.WithMainTypeName("A")).VerifyDiagnostics();
+ var compilation = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe.WithMainTypeName("A")).VerifyDiagnostics();
CompileAndVerify(compilation, expectedOutput: "Non Task Main", expectedReturnCode: 0);
}
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncMethodBuilderOverrideTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncMethodBuilderOverrideTests.cs
index 6c4a94e3e62c7..fc204d27f2eb2 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncMethodBuilderOverrideTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncMethodBuilderOverrideTests.cs
@@ -113,7 +113,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Regular9);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Regular9);
compilation.VerifyDiagnostics(
// (11,25): error CS8773: Feature 'async method builder override' is not available in C# 9.0. Please use language version 10.0 or greater.
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -126,7 +126,7 @@ class C
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "M").WithArguments("async method builder override", "10.0").WithLocation(17, 37)
);
- compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Regular10);
+ compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Regular10);
var verifier = CompileAndVerify(compilation, expectedOutput: "M F G 3");
verifier.VerifyDiagnostics();
var testData = verifier.TestData;
@@ -223,7 +223,7 @@ public static async MyTask M()
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Regular10);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Regular10);
compilation.VerifyDiagnostics(
// (14,16): warning CS8603: Possible null reference return.
// return default(T); // 1
@@ -274,7 +274,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (9,51): error CS1997: Since 'C.F()' is an async method that returns 'MyTask', a return keyword must not be followed by an object expression
// static async MyTask F() { await Task.Yield(); return 1; } // 1
@@ -328,7 +328,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics();
}
@@ -366,7 +366,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics();
}
@@ -404,7 +404,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics();
}
@@ -444,7 +444,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics();
}
@@ -482,7 +482,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics();
}
@@ -519,7 +519,7 @@ public void BuilderOnMethod_DummyBuilderOnType_OnLocalFunction(string dummyBuild
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Regular9);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Regular9);
compilation.VerifyDiagnostics(
// (9,21): error CS8773: Feature 'async method builder override' is not available in C# 9.0. Please use language version 10.0 or greater.
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -532,7 +532,7 @@ public void BuilderOnMethod_DummyBuilderOnType_OnLocalFunction(string dummyBuild
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "M").WithArguments("async method builder override", "10.0").WithLocation(15, 26)
);
- compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Regular10);
+ compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Regular10);
var verifier = CompileAndVerify(compilation, expectedOutput: "M F G 3");
verifier.VerifyDiagnostics();
}
@@ -568,7 +568,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,32): error CS0246: The type or namespace name 'Error' could not be found (are you missing a using directive or an assembly reference?)
// [AsyncMethodBuilder(typeof(Error))]
@@ -614,7 +614,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (9,29): error CS1983: The return type of an async method must be void, Task, Task, a task-like type, IAsyncEnumerable, or IAsyncEnumerator
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -693,7 +693,7 @@ class C
{asyncBuilderFactoryCode("MyTaskMethodBuilder", "MyTask", "T", isStruct: true)}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (11,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilderFactory.Create'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -763,7 +763,7 @@ public void BuilderOnMethod_OnLambda()
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T", isStruct: true)}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Regular9);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Regular9);
compilation.VerifyEmitDiagnostics(
// (6,18): error CS8773: Feature 'lambda attributes' is not available in C# 9.0. Please use language version 10.0 or greater.
// Func f = [AsyncMethodBuilder(typeof(MyTaskMethodBuilder))] static async () => { System.Console.Write("F "); await Task.Delay(0); };
@@ -784,7 +784,7 @@ public void BuilderOnMethod_OnLambda()
// Func> m = [AsyncMethodBuilder(typeof(MyTaskMethodBuilder<>))] async () => { System.Console.Write("M "); await f(); return 3; };
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "=>").WithArguments("async method builder override", "10.0").WithLocation(8, 84)
);
- compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Regular10);
+ compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Regular10);
compilation.VerifyEmitDiagnostics(
// (6,84): error CS8933: The AsyncMethodBuilder attribute is disallowed on anonymous methods without an explicit return type.
// Func f = [AsyncMethodBuilder(typeof(MyTaskMethodBuilder))] static async () => { System.Console.Write("F "); await Task.Delay(0); };
@@ -817,7 +817,7 @@ public void BuilderOnMethod_OnLambda_WithExplicitType()
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T", isStruct: true)}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Regular9);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Regular9);
compilation.VerifyEmitDiagnostics(
// (6,18): error CS8773: Feature 'lambda attributes' is not available in C# 9.0. Please use language version 10.0 or greater.
// Func f = [AsyncMethodBuilder(typeof(MyTaskMethodBuilder))] static async MyTask () => { System.Console.Write("F "); await Task.Delay(0); };
@@ -839,7 +839,7 @@ public void BuilderOnMethod_OnLambda_WithExplicitType()
Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, "=>").WithArguments("async method builder override", "10.0").WithLocation(8, 96)
);
- compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Regular10);
+ compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Regular10);
var verifier = CompileAndVerify(compilation, expectedOutput: "M F 3");
verifier.VerifyDiagnostics();
}
@@ -880,7 +880,7 @@ public class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T", isStruct: true)}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (7,71): error CS8935: The AsyncMethodBuilder attribute is disallowed on anonymous methods without an explicit return type.
// [AsyncMethodBuilder(typeof(MyTaskMethodBuilder))] static async () => { System.Console.Write("Lambda1 "); await Task.Delay(0); } // 1
@@ -938,7 +938,7 @@ public class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T", isStruct: true)}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
var verifier = CompileAndVerify(compilation, expectedOutput: "Overload1 Lambda1 Overload2 Lambda2");
verifier.VerifyDiagnostics();
@@ -980,7 +980,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public MyTask Task", "public object Task")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyDiagnostics();
compilation.VerifyEmitDiagnostics(
// (8,29): error CS8204: For type 'MyTaskMethodBuilder' to be used as an AsyncMethodBuilder for type 'MyTask', its Task property should return type 'MyTask' instead of type 'object'.
@@ -1024,7 +1024,7 @@ class C
.Replace("public static MyTaskMethodBuilder Create() => new MyTaskMethodBuilder(new MyTask());", "")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyDiagnostics();
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.Create'
@@ -1067,7 +1067,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public static MyTaskMethodBuilder Create()", accessibility + " static MyTaskMethodBuilder Create()")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.Create'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -1107,7 +1107,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public static MyTaskMethodBuilder Create()", "public MyTaskMethodBuilder Create()")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyDiagnostics();
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.Create'
@@ -1148,7 +1148,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public static MyTaskMethodBuilder Create()", "public static MyTaskMethodBuilder Create(int i)")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyDiagnostics();
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.Create'
@@ -1189,7 +1189,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public static MyTaskMethodBuilder Create()", "public static MyTaskMethodBuilder Create()")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyDiagnostics();
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.Create'
@@ -1238,7 +1238,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyDiagnostics();
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.Create'
@@ -1282,7 +1282,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public class MyTaskMethodBuilder", "internal class MyTaskMethodBuilder")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
CompileAndVerify(compilation, expectedOutput: "M F G 3");
}
@@ -1316,7 +1316,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
CompileAndVerify(compilation, expectedOutput: "M F G 3");
}
@@ -1346,7 +1346,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public static MyTaskMethodBuilder Create()", "internal static MyTaskMethodBuilder Create()")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.Create'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -1398,7 +1398,7 @@ class AsyncMethodBuilderAttribute : System.Attribute {{ public AsyncMethodBuilde
}}
";
// The first attribute is used
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics();
CompileAndVerify(compilation, expectedOutput: "M F G 3");
}
@@ -1439,7 +1439,7 @@ class AsyncMethodBuilderAttribute : System.Attribute {{ public AsyncMethodBuilde
}}
";
// The first attribute is used
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (10,29): error CS1983: The return type of an async method must be void, Task, Task, a task-like type, IAsyncEnumerable, or IAsyncEnumerator
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -1473,7 +1473,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,25): error CS0416: 'MyTaskMethodBuilder': an attribute argument cannot use type parameters
// [AsyncMethodBuilder(typeof(MyTaskMethodBuilder))]
@@ -1501,7 +1501,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source);
+ var compilation = CreateCompilationWithMscorlib461(source);
compilation.VerifyEmitDiagnostics(
// (9,34): error CS8940: A generic task-like return type was expected, but the type 'MyTaskMethodBuilder' found in 'AsyncMethodBuilder' attribute was not suitable. It must be an unbound generic type of arity one, and its containing type (if any) must be non-generic.
// static async MyTask M() { await Task.Delay(0); throw null; }
@@ -1535,7 +1535,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public MyTask Task =>", "internal MyTask Task =>")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.Task'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -1575,7 +1575,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public MyTask Task => _task;", "public static MyTask Task => throw null;")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.Task'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -1615,7 +1615,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public MyTask Task => _task;", "public MyTask Task = null;")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.Task'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -1655,7 +1655,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public void SetException", "internal void SetException")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.SetException'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -1699,7 +1699,7 @@ class C
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.SetException'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -1739,7 +1739,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public void SetException(System.Exception e)", "public void SetException()")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.SetException'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -1779,7 +1779,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public void SetResult", "internal void SetResult")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.SetResult'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -1819,7 +1819,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public void AwaitOnCompleted", "internal void AwaitOnCompleted")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.AwaitOnCompleted'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -1859,7 +1859,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public void AwaitUnsafeOnCompleted", "internal void AwaitUnsafeOnCompleted")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.AwaitUnsafeOnCompleted'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -1899,7 +1899,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public void Start", "internal void Start")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.Start'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
@@ -1939,7 +1939,7 @@ class C
{AsyncBuilderCode("MyTaskMethodBuilder", "MyTask", "T").Replace("public void SetStateMachine", "internal void SetStateMachine")}
{AsyncMethodBuilderAttribute}
";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularPreview);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.RegularPreview);
compilation.VerifyEmitDiagnostics(
// (8,29): error CS0656: Missing compiler required member 'MyTaskMethodBuilder.SetStateMachine'
// static async MyTask F() { System.Console.Write("F "); await Task.Delay(0); }
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncTests.cs
index fa39f561f1e8b..7f8262a363782 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncTests.cs
@@ -23,10 +23,10 @@ private static CSharpCompilation CreateCompilation(string source, IEnumerable asyncRefs = new[] { Net451.System, Net451.SystemCore, Net451.MicrosoftCSharp };
+ IEnumerable asyncRefs = new[] { NetFramework.System, NetFramework.SystemCore, NetFramework.MicrosoftCSharp };
references = (references != null) ? references.Concat(asyncRefs) : asyncRefs;
- return CreateCompilationWithMscorlib45(source, options: options, references: references);
+ return CreateCompilationWithMscorlib461(source, options: options, references: references);
}
private CompilationVerifier CompileAndVerify(string source, string expectedOutput, IEnumerable references = null, CSharpCompilationOptions options = null, Verification verify = default)
@@ -54,7 +54,7 @@ public static void Main()
F(123).Wait();
}
}";
- var c = CreateCompilationWithMscorlib45(source);
+ var c = CreateCompilationWithMscorlib461(source);
CompilationOptions options;
@@ -3703,7 +3703,7 @@ public void AsyncTasklikeMissingBuilderType()
{
// Builder
var libB = @"public class B { }";
- var cB = CreateCompilationWithMscorlib45(libB);
+ var cB = CreateCompilationWithMscorlib461(libB);
var rB = cB.EmitToImageReference();
// Tasklike
@@ -3714,7 +3714,7 @@ public void AsyncTasklikeMissingBuilderType()
namespace System.Runtime.CompilerServices { class AsyncMethodBuilderAttribute : System.Attribute { public AsyncMethodBuilderAttribute(System.Type t) { } } }
";
- var cT = CreateCompilationWithMscorlib45(libT, references: new[] { rB });
+ var cT = CreateCompilationWithMscorlib461(libT, references: new[] { rB });
var rT = cT.EmitToImageReference();
// Consumer, fails to reference builder
@@ -3726,7 +3726,7 @@ static void Main() { }
async T f() => await Task.Delay(1);
}
";
- var c = CreateCompilationWithMscorlib45(source, references: new[] { rT });
+ var c = CreateCompilationWithMscorlib461(source, references: new[] { rT });
c.VerifyEmitDiagnostics(
// (6,17): error CS1983: The return type of an async method must be void, Task or Task
// async T f() => await Task.Delay(1);
@@ -4023,7 +4023,7 @@ class Mismatch2MethodBuilder
}
namespace System.Runtime.CompilerServices { class AsyncMethodBuilderAttribute : System.Attribute { public AsyncMethodBuilderAttribute(System.Type t) { } } }
";
- var comp = CreateCompilationWithMscorlib45(source);
+ var comp = CreateCompilationWithMscorlib461(source);
comp.VerifyEmitDiagnostics(
// (5,30): error CS8940: A generic task-like return type was expected, but the type 'Mismatch1MethodBuilder' found in 'AsyncMethodBuilder' attribute was not suitable. It must be an unbound generic type of arity one, and its containing type (if any) must be non-generic.
// async Mismatch1 f() { await (Task)null; return 1; }
@@ -4501,7 +4501,7 @@ public void AwaitInScriptExpression()
{
var source =
@"System.Console.WriteLine(await System.Threading.Tasks.Task.FromResult(1));";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
compilation.VerifyDiagnostics();
}
@@ -4510,7 +4510,7 @@ public void AwaitInScriptGlobalStatement()
{
var source =
@"await System.Threading.Tasks.Task.FromResult(4);";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
compilation.VerifyDiagnostics();
}
@@ -4520,7 +4520,7 @@ public void AwaitInScriptDeclaration()
var source =
@"int x = await System.Threading.Tasks.Task.Run(() => 2);
System.Console.WriteLine(x);";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
compilation.VerifyDiagnostics();
}
@@ -4564,7 +4564,7 @@ public void AwaitInScriptStaticInitializer()
await System.Threading.Tasks.Task.FromResult(1);
int y = x +
await System.Threading.Tasks.Task.FromResult(2);";
- var compilation = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
+ var compilation = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
compilation.VerifyDiagnostics(
// (2,5): error CS8100: The 'await' operator cannot be used in a static script variable initializer.
// await System.Threading.Tasks.Task.FromResult(1);
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenConversionTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenConversionTests.cs
index e78e792a938e4..77fb49bd220d4 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenConversionTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenConversionTests.cs
@@ -1067,7 +1067,7 @@ public interface IAaa
";
- var compilation = CreateCompilationWithMscorlib45AndCSharp(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(true));
+ var compilation = CreateCompilationWithMscorlib461AndCSharp(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(true));
CompileAndVerify(compilation);
}
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenDeconstructTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenDeconstructTests.cs
index 32bd50f9a7b3e..c9cb6628f66d0 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenDeconstructTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenDeconstructTests.cs
@@ -5043,7 +5043,7 @@ public void SimpleDeconstructionInScript()
Assert.Equal("alias=System.Int32", model.GetAliasInfo(yType).ToTestDisplayString());
};
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp, expectedOutput: "hello 42", sourceSymbolValidator: validator);
@@ -5116,7 +5116,7 @@ public void GlobalDeconstructionOutsideScript()
System.Console.Write(x);
System.Console.Write(y);
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Regular9, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Regular9, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
@@ -5134,7 +5134,7 @@ public void NestedDeconstructionInScript()
(string x, (int y, int z)) = (""hello"", (42, 43));
System.Console.Write($""{x} {y} {z}"");
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp, expectedOutput: "hello 42 43");
@@ -5148,7 +5148,7 @@ public void VarDeconstructionInScript()
(var x, var y) = (""hello"", 42);
System.Console.Write($""{x} {y}"");
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp, expectedOutput: "hello 42");
@@ -5194,7 +5194,7 @@ public void NestedVarDeconstructionInScript()
Assert.Equal("(System.Int32 x2, System.Int32 x3)", model.GetSymbolInfo(x23Var.Type).Symbol.ToTestDisplayString());
};
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp, expectedOutput: "hello 42 43", sourceSymbolValidator: validator);
@@ -5209,7 +5209,7 @@ public void EvaluationOrderForDeconstructionInScript()
var (x2, x3) = M(out var x1);
System.Console.Write($""{x1} {x2} {x3}"");
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp, expectedOutput: "1 2 3");
@@ -5318,7 +5318,7 @@ public void DeconstructionForEachInScript()
Assert.Equal(SymbolKind.Local, x2Symbol.Kind);
};
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp, expectedOutput: "hello 42 world", sourceSymbolValidator: validator);
@@ -5354,7 +5354,7 @@ public void DeconstructionInForLoopInScript()
Assert.Equal(SymbolKind.Local, x2Symbol.Kind);
};
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp, expectedOutput: "hello 42 world", sourceSymbolValidator: validator);
@@ -5368,7 +5368,7 @@ public void DeconstructionInCSharp6Script()
var (x, y) = (1, 2);
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script.WithLanguageVersion(LanguageVersion.CSharp6), options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script.WithLanguageVersion(LanguageVersion.CSharp6), options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics(
// (2,5): error CS8059: Feature 'tuples' is not available in C# 6. Please use language version 7.0 or greater.
@@ -5388,7 +5388,7 @@ public void InvalidDeconstructionInScript()
int (x, y) = (1, 2);
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics(
// (2,5): error CS8136: Deconstruction 'var (...)' form disallows a specific type for 'var'.
// int (x, y) = (1, 2);
@@ -5421,7 +5421,7 @@ public void InvalidDeconstructionInScript_2()
(int (x, y), int z) = ((1, 2), 3);
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics(
// (2,6): error CS8136: Deconstruction 'var (...)' form disallows a specific type for 'var'.
// (int (x, y), int z) = ((1, 2), 3);
@@ -5456,7 +5456,7 @@ public void NameConflictInDeconstructionInScript()
System.Console.Write(x1);
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics(
// (3,6): error CS0102: The type 'Script' already contains a definition for 'x1'
// var (x1, x2) = (1, 2);
@@ -5491,7 +5491,7 @@ public void NameConflictInDeconstructionInScript2()
var (z, y) = (1, 2);
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics(
// (3,9): error CS0102: The type 'Script' already contains a definition for 'y'
// var (z, y) = (1, 2);
@@ -5522,7 +5522,7 @@ public void NameConflictInDeconstructionInScript3()
var (x, (y, x)) = (1, (2, ""hello""));
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics(
// (2,13): error CS0102: The type 'Script' already contains a definition for 'x'
// var (x, (y, x)) = (1, (2, "hello"));
@@ -5554,7 +5554,7 @@ public void UnassignedUsedInDeconstructionInScript()
var (x, y) = (1, 2);
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
CompileAndVerify(comp, expectedOutput: "0");
@@ -5579,7 +5579,7 @@ public void FailedInferenceInDeconstructionInScript()
var (x, y) = (1, null);
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.GetDeclarationDiagnostics().Verify(
// (2,6): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'x'.
// var (x, y) = (1, null);
@@ -5627,7 +5627,7 @@ public void FailedCircularInferenceInDeconstructionInScript()
var (x1, x2) = (x2, x1);
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.GetDeclarationDiagnostics().Verify(
// (2,10): error CS7019: Type of 'x2' cannot be inferred since its initializer directly or indirectly refers to the definition.
// var (x1, x2) = (x2, x1);
@@ -5668,7 +5668,7 @@ public void FailedCircularInferenceInDeconstructionInScript2()
var (y1, y2) = (x1, x2);
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.GetDeclarationDiagnostics().Verify(
// (3,6): error CS7019: Type of 'y1' cannot be inferred since its initializer directly or indirectly refers to the definition.
// var (y1, y2) = (x1, x2);
@@ -5713,7 +5713,7 @@ public void VarAliasInVarDeconstructionInScript()
System.Console.Write($""{x1} {x2} {x3}"");
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics(
// (3,5): error CS8136: Deconstruction 'var (...)' form disallows a specific type for 'var'.
// var (x1, (x2, x3)) = (1, (2, 3));
@@ -5755,7 +5755,7 @@ class @var
System.Console.Write($""{x1} {x2} {x3}"");
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics(
// (6,5): error CS8136: Deconstruction 'var (...)' form disallows a specific type for 'var'.
// var (x1, (x2, x3)) = (1, (2, 3));
@@ -5794,7 +5794,7 @@ public void VarAliasInTypedDeconstructionInScript()
System.Console.Write($""{x1} {x2} {x3}"");
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
CompileAndVerify(comp, expectedOutput: "1 2 3");
@@ -5844,7 +5844,7 @@ class @var
System.Console.Write($""{x1} {x2} {x3}"");
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
CompileAndVerify(comp, expectedOutput: "var var var");
@@ -6677,7 +6677,7 @@ async void M()
}
";
- var comp = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugDll);
+ var comp = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugDll);
comp.VerifyDiagnostics(
// (6,9): warning CS4014: Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.
// System.Threading.Tasks.Task.Delay(new System.TimeSpan(0));
@@ -6874,7 +6874,7 @@ public void SimpleDiscardDeconstructInScript()
Assert.Equal("(System.String, System.Int32)", model.GetTypeInfo(tuple).Type.ToTestDisplayString());
};
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
CompileAndVerify(comp, sourceSymbolValidator: validator);
@@ -6893,7 +6893,7 @@ public class C
(string _, string _) = new C();
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe);
comp.VerifyDiagnostics();
CompileAndVerify(comp, expectedOutput: "ctor");
@@ -6908,7 +6908,7 @@ public void SingleDiscardInAssignmentInScript()
_ = M();
";
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
CompileAndVerify(comp, expectedOutput: "M");
}
@@ -6943,7 +6943,7 @@ public void NestedVarDiscardDeconstructionInScript()
Assert.Null(model.GetSymbolInfo(tuple).Symbol);
};
- var comp = CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
+ var comp = CreateCompilationWithMscorlib461(source, parseOptions: TestOptions.Script, options: TestOptions.DebugExe, references: s_valueTupleRefs);
comp.VerifyDiagnostics();
CompileAndVerify(comp, expectedOutput: "43", sourceSymbolValidator: validator);
@@ -8204,7 +8204,7 @@ static async Task M()
}
";
- var comp = CreateCompilationWithMscorlib45(source, references: s_valueTupleRefs, options: TestOptions.DebugExe);
+ var comp = CreateCompilationWithMscorlib461(source, references: s_valueTupleRefs, options: TestOptions.DebugExe);
comp.VerifyDiagnostics();
var verifier = CompileAndVerify(comp, expectedOutput: "3");
}
@@ -8225,7 +8225,7 @@ void M()
}
";
- var comp = CreateCompilationWithMscorlib45(source, references: s_valueTupleRefs, options: TestOptions.DebugDll);
+ var comp = CreateCompilationWithMscorlib461(source, references: s_valueTupleRefs, options: TestOptions.DebugDll);
comp.VerifyDiagnostics(
// (8,11): warning CS1717: Assignment made to same variable; did you mean to assign something else?
// ((x, x), this.x, C.y) = ((x, (1, 2)), x, y);
@@ -8256,7 +8256,7 @@ void M()
}
";
- var comp = CreateCompilationWithMscorlib45(source, references: s_valueTupleRefs, options: TestOptions.DebugDll);
+ var comp = CreateCompilationWithMscorlib461(source, references: s_valueTupleRefs, options: TestOptions.DebugDll);
comp.VerifyDiagnostics(
// (9,10): warning CS1717: Assignment made to same variable; did you mean to assign something else?
// (x, (y, z)) = (x, (y, z));
@@ -8291,7 +8291,7 @@ class D
}
";
- var comp = CreateCompilationWithMscorlib45(source, references: s_valueTupleRefs, options: TestOptions.DebugDll);
+ var comp = CreateCompilationWithMscorlib461(source, references: s_valueTupleRefs, options: TestOptions.DebugDll);
comp.VerifyDiagnostics(
// (8,10): warning CS1717: Assignment made to same variable; did you mean to assign something else?
// (x, y) = (x, (C)(D)y);
@@ -8321,7 +8321,7 @@ void M()
}
";
- var comp = CreateCompilationWithMscorlib45(source, references: s_valueTupleRefs, options: TestOptions.DebugDll);
+ var comp = CreateCompilationWithMscorlib461(source, references: s_valueTupleRefs, options: TestOptions.DebugDll);
comp.VerifyDiagnostics(
// (14,14): warning CS1717: Assignment made to same variable; did you mean to assign something else?
// (_, (x, y)) = (1, (x, b));
@@ -8350,7 +8350,7 @@ void M()
}
";
- var comp = CreateCompilationWithMscorlib45(source, references: s_valueTupleRefs, options: TestOptions.DebugDll);
+ var comp = CreateCompilationWithMscorlib461(source, references: s_valueTupleRefs, options: TestOptions.DebugDll);
comp.VerifyDiagnostics(
);
@@ -8406,7 +8406,7 @@ public static void Deconstruct(this object input, out object output1, out object
}
}";
- var comp = CreateCompilationWithMscorlib45(source, references: s_valueTupleRefs, options: TestOptions.DebugDll);
+ var comp = CreateCompilationWithMscorlib461(source, references: s_valueTupleRefs, options: TestOptions.DebugDll);
comp.VerifyDiagnostics(
// (9,10): warning CS1717: Assignment made to same variable; did you mean to assign something else?
// (x, (y, z)) = (x, y);
@@ -8429,7 +8429,7 @@ Error M()
}
}";
- var comp = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugDll); // no ValueTuple reference
+ var comp = CreateCompilationWithMscorlib461(source, options: TestOptions.DebugDll); // no ValueTuple reference
comp.VerifyDiagnostics(
// (4,5): error CS0246: The type or namespace name 'Error' could not be found (are you missing a using directive or an assembly reference?)
// Error M()
@@ -8441,10 +8441,10 @@ Error M()
public void TestDeconstructOnErrorTypeFromImageReference()
{
var missing_cs = "public class Missing { }";
- var missing = CreateCompilationWithMscorlib45(missing_cs, options: TestOptions.DebugDll, assemblyName: "missing");
+ var missing = CreateCompilationWithMscorlib461(missing_cs, options: TestOptions.DebugDll, assemblyName: "missing");
var lib_cs = "public class C { public Missing M() { throw null; } }";
- var lib = CreateCompilationWithMscorlib45(lib_cs, references: new[] { missing.EmitToImageReference() }, options: TestOptions.DebugDll);
+ var lib = CreateCompilationWithMscorlib461(lib_cs, references: new[] { missing.EmitToImageReference() }, options: TestOptions.DebugDll);
var source =
@"
@@ -8458,7 +8458,7 @@ void M()
}
}";
- var comp = CreateCompilationWithMscorlib45(source, references: new[] { lib.EmitToImageReference() }, options: TestOptions.DebugDll); // no ValueTuple reference
+ var comp = CreateCompilationWithMscorlib461(source, references: new[] { lib.EmitToImageReference() }, options: TestOptions.DebugDll); // no ValueTuple reference
comp.VerifyDiagnostics(
// (7,18): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// (x, y) = new C().M();
@@ -8470,10 +8470,10 @@ void M()
public void TestDeconstructOnErrorTypeFromCompilationReference()
{
var missing_cs = "public class Missing { }";
- var missing = CreateCompilationWithMscorlib45(missing_cs, options: TestOptions.DebugDll, assemblyName: "missing");
+ var missing = CreateCompilationWithMscorlib461(missing_cs, options: TestOptions.DebugDll, assemblyName: "missing");
var lib_cs = "public class C { public Missing M() { throw null; } }";
- var lib = CreateCompilationWithMscorlib45(lib_cs, references: new[] { missing.ToMetadataReference() }, options: TestOptions.DebugDll);
+ var lib = CreateCompilationWithMscorlib461(lib_cs, references: new[] { missing.ToMetadataReference() }, options: TestOptions.DebugDll);
var source =
@"
@@ -8487,7 +8487,7 @@ void M()
}
}";
- var comp = CreateCompilationWithMscorlib45(source, references: new[] { lib.ToMetadataReference() }, options: TestOptions.DebugDll); // no ValueTuple reference
+ var comp = CreateCompilationWithMscorlib461(source, references: new[] { lib.ToMetadataReference() }, options: TestOptions.DebugDll); // no ValueTuple reference
comp.VerifyDiagnostics(
// (7,18): error CS0012: The type 'Missing' is defined in an assembly that is not referenced. You must add a reference to assembly 'missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// (x, y) = new C().M();
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenDynamicTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenDynamicTests.cs
index f6560bb991044..2331a9abfa16a 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenDynamicTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenDynamicTests.cs
@@ -38,8 +38,8 @@ private CompilationVerifier CompileAndVerifyIL(
references = references ?? new[] { SystemCoreRef, CSharpRef };
// verify that we emit correct optimized and unoptimized IL:
- var unoptimizedCompilation = CreateCompilationWithMscorlib45(source, references, parseOptions: parseOptions, options: TestOptions.DebugDll.WithMetadataImportOptions(MetadataImportOptions.All).WithAllowUnsafe(allowUnsafe));
- var optimizedCompilation = CreateCompilationWithMscorlib45(source, references, parseOptions: parseOptions, options: TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.All).WithAllowUnsafe(allowUnsafe));
+ var unoptimizedCompilation = CreateCompilationWithMscorlib461(source, references, parseOptions: parseOptions, options: TestOptions.DebugDll.WithMetadataImportOptions(MetadataImportOptions.All).WithAllowUnsafe(allowUnsafe));
+ var optimizedCompilation = CreateCompilationWithMscorlib461(source, references, parseOptions: parseOptions, options: TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.All).WithAllowUnsafe(allowUnsafe));
var unoptimizedVerifier = CompileAndVerify(unoptimizedCompilation, verify: verify);
var optimizedVerifier = CompileAndVerify(optimizedCompilation, verify: verify);
@@ -7489,7 +7489,7 @@ public class Color
Color Color;
dynamic x = Color.F((dynamic)1);
";
- var script = CreateCompilationWithMscorlib45(
+ var script = CreateCompilationWithMscorlib461(
new[] { Parse(sourceScript, options: TestOptions.Script) },
new[] { new CSharpCompilationReference(lib), SystemCoreRef, CSharpRef });
@@ -7587,7 +7587,7 @@ void Goo()
dynamic x = Color.F((dynamic)1);
}
";
- var script = CreateCompilationWithMscorlib45(
+ var script = CreateCompilationWithMscorlib461(
new[] { Parse(sourceScript, options: TestOptions.Script) },
new[] { new CSharpCompilationReference(lib), SystemCoreRef, CSharpRef },
TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.All));
@@ -15787,7 +15787,7 @@ static void F(dynamic d)
d.F();
}
}";
- var comp = CreateCompilationWithMscorlib45(
+ var comp = CreateCompilationWithMscorlib461(
new[] { DynamicAttributeSource, source },
references: new[] { SystemRef_v4_0_30319_17929, SystemCoreRef_v4_0_30319_17929 });
comp.VerifyEmitDiagnostics(
@@ -15809,7 +15809,7 @@ static async Task F(dynamic d)
await d;
}
}";
- var comp = CreateCompilationWithMscorlib45(
+ var comp = CreateCompilationWithMscorlib461(
new[] { DynamicAttributeSource, source },
references: new[] { SystemRef_v4_0_30319_17929, SystemCoreRef_v4_0_30319_17929 });
comp.VerifyEmitDiagnostics(
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenExprLambdaTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenExprLambdaTests.cs
index 91bf7680c94dd..1214a4f7da795 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenExprLambdaTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenExprLambdaTests.cs
@@ -2460,14 +2460,15 @@ .maxstack 7
}
");
- var comp45 = CreateCompilationWithMscorlib45(
+ var comp = CreateCompilationWithMscorlib461(
new[] { text, ExpressionTestLibrary },
new[] { ExpressionAssemblyRef },
options: TestOptions.ReleaseExe);
+ comp.MakeMemberMissing(SpecialMember.System_Array__Empty);
// no use Array.Empty here since it is not available
CompileAndVerify(
- comp45,
+ comp,
expectedOutput: expectedOutput).
VerifyIL("Test.Main",
@"
@@ -3519,7 +3520,7 @@ static void Main(string[] args)
//NOTE: different shape of delegate creation in 45+ is bydesign and matches behavior of the with old compiler.
string expectedOutput45 = @"Convert(Call(Constant(Int32 Func1(System.String) Type:System.Reflection.MethodInfo).[System.Delegate CreateDelegate(System.Type, System.Object)](Constant(Del Type:System.Type), Parameter(tc1 Type:TestClass1)) Type:System.Delegate) Type:Del)";
- var comp45 = CreateCompilationWithMscorlib45(
+ var comp45 = CreateCompilationWithMscorlib461(
new[] { source, ExpressionTestLibrary },
new[] { ExpressionAssemblyRef },
TestOptions.ReleaseExe);
@@ -5939,7 +5940,7 @@ protected static void Lambda(Expression e, ParameterExpression[] args) { }
public class Expression { }
public class ParameterExpression : Expression { }
}";
- var compilation1 = CreateCompilationWithMscorlib45(source1);
+ var compilation1 = CreateCompilationWithMscorlib461(source1);
compilation1.VerifyDiagnostics();
var reference1 = compilation1.EmitToImageReference();
@@ -5950,7 +5951,7 @@ class C
{
static Expression E = () => 1;
}";
- var compilation2 = CreateCompilationWithMscorlib45(source2, references: new[] { reference1 });
+ var compilation2 = CreateCompilationWithMscorlib461(source2, references: new[] { reference1 });
compilation2.VerifyDiagnostics();
using (var stream = new MemoryStream())
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenFieldInitTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenFieldInitTests.cs
index e3dac2d9e0c0b..b421dd2588486 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenFieldInitTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenFieldInitTests.cs
@@ -655,7 +655,7 @@ public void Ordering()
expectedOutput.AppendLine(i.ToString());
}
- var compilation = CreateCompilationWithMscorlib45(trees, options: TestOptions.ReleaseExe);
+ var compilation = CreateCompilationWithMscorlib461(trees, options: TestOptions.ReleaseExe);
CompileAndVerify(compilation, expectedOutput: expectedOutput.ToString());
}
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenImplicitlyTypeArraysTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenImplicitlyTypeArraysTests.cs
index a2bf867ce0594..fd4c0b1f8a24d 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenImplicitlyTypeArraysTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenImplicitlyTypeArraysTests.cs
@@ -11,6 +11,7 @@
using Microsoft.CodeAnalysis.Text;
using Roslyn.Test.Utilities;
using Xunit;
+using Basic.Reference.Assemblies;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests.CodeGen
{
@@ -280,7 +281,7 @@ public static void Main()
}
}
";
- var mscorlib17626 = MetadataReference.CreateFromImage(TestMetadata.ResourcesNet451.mscorlib);
+ var mscorlib17626 = MetadataReference.CreateFromImage(Net461.Resources.mscorlib);
CompileAndVerify(testSrc, new MetadataReference[] { mscorlib17626 }, expectedOutput: "1", targetFramework: TargetFramework.Empty);
}
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenInParametersTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenInParametersTests.cs
index dc493a696634e..1f87e26e45231 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenInParametersTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenInParametersTests.cs
@@ -1154,7 +1154,7 @@ static void M(in int arg1, in (int Alice, int Bob) arg2)
}
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,9): error CS8331: Cannot assign to variable 'arg1' or use it as the right hand side of a ref assignment because it is a readonly variable
// arg1 = 1;
@@ -1206,7 +1206,7 @@ static ref int M2(in int arg1, in (int Alice, int Bob) arg2)
}
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (18,20): error CS8333: Cannot return variable 'arg1' by writable reference because it is a readonly variable
// return ref arg1;
@@ -1231,7 +1231,7 @@ static void M(in int arg1, in (int Alice, int Bob) arg2)
}
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,25): error CS8329: Cannot use variable 'arg1' as a ref or out value because it is a readonly variable
// ref var y = ref arg1;
@@ -1264,7 +1264,7 @@ unsafe static void M(in int arg1, in (int Alice, int Bob) arg2)
}
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, options: TestOptions.UnsafeReleaseDll);
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, options: TestOptions.UnsafeReleaseDll);
comp.VerifyDiagnostics(
// (6,18): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
// int* a = & arg1;
@@ -1297,7 +1297,7 @@ static ref int M(in int arg1, in (int Alice, int Bob) arg2)
}
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (10,24): error CS8333: Cannot return variable 'arg1' by writable reference because it is a readonly variable
// return ref arg1;
@@ -1416,7 +1416,7 @@ ref int M1(in int arg11, in (int Alice, int Bob) arg21)
}
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (12,28): error CS8333: Cannot return variable 'arg11' by writable reference because it is a readonly variable
// return ref arg11;
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenIterators.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenIterators.cs
index ce35d78cc0a5e..3f29bbdb28868 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenIterators.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenIterators.cs
@@ -1936,7 +1936,7 @@ public static IEnumerable Goo()
";
//EDMAURER ensure that we use System.Environment.CurrentManagedThreadId when compiling against 4.5
var parsed = new[] { Parse(source) };
- var comp = CreateCompilationWithMscorlib45(parsed);
+ var comp = CreateCompilationWithMscorlib461(parsed);
var verifier = this.CompileAndVerify(comp);
var il = verifier.VisualizeIL("Program.d__0.System.Collections.Generic.IEnumerable.GetEnumerator()");
Assert.Contains("System.Environment.CurrentManagedThreadId.get", il, StringComparison.Ordinal);
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenLocalFunctionTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenLocalFunctionTests.cs
index e8e3913525cbb..a8dcc43ef9c49 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenLocalFunctionTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenLocalFunctionTests.cs
@@ -2082,7 +2082,7 @@ void LocalFunc(int a = 2) { }
}
}
";
- var comp = CreateCompilationWithMscorlib45AndCSharp(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461AndCSharp(source, options: TestOptions.ReleaseExe);
CompileAndVerify(comp, expectedSignatures: new SignatureDescription[]
{
Signature("C", "Main", ".method public hidebysig static System.Void Main() cil managed"),
@@ -6300,13 +6300,13 @@ static void Local1()
internal CompilationVerifier VerifyOutput(string source, string output, CSharpCompilationOptions options, Verification verify = default)
{
- var comp = CreateCompilationWithMscorlib45AndCSharp(source, options: options);
+ var comp = CreateCompilationWithMscorlib461AndCSharp(source, options: options);
return CompileAndVerify(comp, expectedOutput: output, verify: verify).VerifyDiagnostics(); // no diagnostics
}
internal CompilationVerifier VerifyOutput(string source, string output)
{
- var comp = CreateCompilationWithMscorlib45AndCSharp(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461AndCSharp(source, options: TestOptions.ReleaseExe);
return CompileAndVerify(comp, expectedOutput: output).VerifyDiagnostics(); // no diagnostics
}
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefConditionalOperatorTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefConditionalOperatorTests.cs
index 60ca1c1996c02..e4185ebb12c12 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefConditionalOperatorTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefConditionalOperatorTests.cs
@@ -525,7 +525,7 @@ static async Task One()
}
}";
- var comp = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe);
comp.VerifyEmitDiagnostics(
// (16,10): error CS8325: 'await' cannot be used in an expression containing a ref conditional operator
@@ -570,7 +570,7 @@ static async Task One()
}
}";
- var comp = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe);
comp.VerifyEmitDiagnostics(
// (16,10): error CS8325: 'await' cannot be used in an expression containing a ref conditional operator
@@ -597,7 +597,7 @@ static void Main()
static int val2 = 44;
}
";
- var comp = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe);
comp.VerifyEmitDiagnostics(
// (8,43): error CS8326: Both conditional operator values must be ref values or neither may be a ref value
@@ -628,7 +628,7 @@ static void Main()
static int val1 = 33;
}
";
- var comp = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe);
comp.VerifyEmitDiagnostics(
// (8,27): error CS8156: An expression cannot be used in this context because it may not be returned by reference
@@ -662,7 +662,7 @@ void Test()
}
}
";
- var comp = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular7_1);
+ var comp = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular7_1);
comp.VerifyEmitDiagnostics(
// (15,25): error CS8302: Feature 'ref conditional expression' is not available in C# 7.1. Please use language version 7.2 or greater.
@@ -692,7 +692,7 @@ ref int Test()
}
}
";
- var comp = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe);
comp.VerifyEmitDiagnostics(
// (15,27): error CS8168: Cannot return local 'local1' by reference because it is not a ref local
@@ -723,7 +723,7 @@ ref int Test()
static int val1 = 33;
}
";
- var comp = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe);
comp.VerifyEmitDiagnostics(
// (14,37): error CS8168: Cannot return local 'local2' by reference because it is not a ref local
@@ -759,7 +759,7 @@ struct S1
}
}
";
- var comp = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe);
comp.VerifyEmitDiagnostics(
// (14,38): error CS8168: Cannot return local 'local2' by reference because it is not a ref local
@@ -796,7 +796,7 @@ struct S1
}
}
";
- var comp = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe);
comp.VerifyEmitDiagnostics(
// (15,20): error CS8157: Cannot return 'temp' by reference because it was initialized to a value that cannot be returned by reference
@@ -943,7 +943,7 @@ static void Main()
static short val2 = 44;
}
";
- var comp = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe);
comp.VerifyEmitDiagnostics(
// (8,47): error CS8327: The expression must be of type 'int' to match the alternative ref value
@@ -968,7 +968,7 @@ static void Main()
static System.Func val1 = null;
}
";
- var comp = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461(source, options: TestOptions.ReleaseExe);
comp.VerifyEmitDiagnostics(
// (8,47): error CS8156: An expression cannot be used in this context because it may not be returned by reference
@@ -1194,7 +1194,7 @@ static void Main()
}
";
- var comp = CreateCompilationWithMscorlib45(source, references: new[] { SystemRuntimeFacadeRef, ValueTupleRef }, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461(source, references: new[] { SystemRuntimeFacadeRef, ValueTupleRef }, options: TestOptions.ReleaseExe);
comp.VerifyEmitDiagnostics(
// (9,32): error CS1061: '(int Alice, int)' does not contain a definition for 'Bob' and no extension method 'Bob' accepting a first argument of type '(int Alice, int)' could be found (are you missing a using directive or an assembly reference?)
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReadonlyReturnTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReadonlyReturnTests.cs
index 5cf694c120e30..f8bd426515e5b 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReadonlyReturnTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReadonlyReturnTests.cs
@@ -499,7 +499,7 @@ static readonly int M1(int x)
}
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,25): error CS1031: Type expected
// static ref readonly ref int M(int x)
@@ -539,7 +539,7 @@ static void Test()
}
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,9): error CS8331: Cannot assign to method 'M' or use it as the right hand side of a ref assignment because it is a readonly variable
// M() = 1;
@@ -585,7 +585,7 @@ static void Test()
}
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,9): error CS8331: Cannot assign to property 'P' or use it as the right hand side of a ref assignment because it is a readonly variable
// P = 1;
@@ -629,7 +629,7 @@ static void Test()
}
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,25): error CS8329: Cannot use method 'M' as a ref or out value because it is a readonly variable
// ref var y = ref M();
@@ -685,7 +685,7 @@ unsafe static void Test()
}
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, options: TestOptions.UnsafeReleaseDll);
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, options: TestOptions.UnsafeReleaseDll);
comp.VerifyDiagnostics(
// (6,18): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
// int* a = & M();
@@ -743,7 +743,7 @@ static ref int Test()
}
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (12,28): error CS8333: Cannot return method 'M' by writable reference because it is a readonly variable
// return ref M();
@@ -970,7 +970,7 @@ ref readonly int Test()
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular10);
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular10);
comp.VerifyDiagnostics(
// (11,30): error CS8168: Cannot return local 'local' by reference because it is not a ref local
// return ref M(ref local);
@@ -986,7 +986,7 @@ ref readonly int Test()
Diagnostic(ErrorCode.ERR_EscapeCall2, "M1(out local)").WithArguments("Program.M1(out int)", "x").WithLocation(15, 24)
);
- comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (11,30): error CS8168: Cannot return local 'local' by reference because it is not a ref local
// return ref M(ref local);
@@ -1014,7 +1014,7 @@ ref readonly int Test()
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (8,25): error CS8168: Cannot return local 'local' by reference because it is not a ref local
// return ref this[local];
@@ -1041,7 +1041,7 @@ ref readonly int Test()
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,25): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref this[42];
@@ -1071,7 +1071,7 @@ ref readonly S1 Test()
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (8,20): error CS8170: Struct members cannot return 'this' or other instance members by reference
// return ref this;
@@ -1097,7 +1097,7 @@ ref readonly int Test()
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,20): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref 42;
@@ -1121,7 +1121,7 @@ ref readonly int Test()
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,22): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref M(42);
@@ -1148,7 +1148,7 @@ ref readonly int Test()
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,20): error CS8156: An expression cannot be used in this context because it may not be passed or returned by reference
// return ref M();
@@ -1176,7 +1176,7 @@ ref readonly int Test()
";
- var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
+ var comp = CreateCompilationWithMscorlib461(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (7,22): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref M(b);
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReturnTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReturnTests.cs
index 728fafdf945a1..e24e1f369bbec 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReturnTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefReturnTests.cs
@@ -2924,7 +2924,7 @@ public static void F1(ref dynamic d)
";
- CreateCompilationWithMscorlib45AndCSharp(source).VerifyEmitDiagnostics(
+ CreateCompilationWithMscorlib461AndCSharp(source).VerifyEmitDiagnostics(
// (18,20): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref d.Length;
Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "d.Length").WithLocation(18, 20)
@@ -2964,7 +2964,7 @@ public static ref dynamic F1(ref dynamic d)
";
- var comp = CreateCompilationWithMscorlib45AndCSharp(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461AndCSharp(source, options: TestOptions.ReleaseExe);
var v = CompileAndVerify(comp, verify: Verification.Fails, expectedOutput: "2");
@@ -3077,7 +3077,7 @@ public static ref dynamic Test(ref dynamic arg1, ref dynamic arg2)
}
";
- var comp = CreateCompilationWithMscorlib45AndCSharp(source, options: TestOptions.ReleaseExe);
+ var comp = CreateCompilationWithMscorlib461AndCSharp(source, options: TestOptions.ReleaseExe);
var v = CompileAndVerify(comp, verify: Verification.Fails, expectedOutput: "2");
}
@@ -3113,7 +3113,7 @@ public static void F1(ref dynamic d)
";
- CreateCompilationWithMscorlib45AndCSharp(source).VerifyEmitDiagnostics(
+ CreateCompilationWithMscorlib461AndCSharp(source).VerifyEmitDiagnostics(
// (17,20): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref d[0];
Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "d[0]").WithLocation(17, 20)
@@ -3149,7 +3149,7 @@ public static ref dynamic G(ref dynamic d)
";
- CreateCompilationWithMscorlib45AndCSharp(source).VerifyEmitDiagnostics(
+ CreateCompilationWithMscorlib461AndCSharp(source).VerifyEmitDiagnostics(
// (14,26): error CS8156: An expression cannot be used in this context because it may not be returned by reference
// return ref G(ref d.Length);
Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "d.Length").WithLocation(14, 26),
@@ -3179,7 +3179,7 @@ public void RefReturnVarianceDelegate()
";
- CreateCompilationWithMscorlib45AndCSharp(source).VerifyEmitDiagnostics(
+ CreateCompilationWithMscorlib461AndCSharp(source).VerifyEmitDiagnostics(
// (6,10): error CS1961: Invalid variance: The type parameter 'T' must be invariantly valid on 'RefFunc3.Invoke()'. 'T' is covariant.
// delegate ref T RefFunc3();
Diagnostic(ErrorCode.ERR_UnexpectedVariance, "ref T").WithArguments("RefFunc3.Invoke()", "T", "covariant", "invariantly").WithLocation(6, 10),
@@ -3222,7 +3222,7 @@ interface IM3f { ref Func RefMethod(); }
";
- CreateCompilationWithMscorlib45AndCSharp(source).VerifyEmitDiagnostics(
+ CreateCompilationWithMscorlib461AndCSharp(source).VerifyEmitDiagnostics(
// (6,24): error CS1961: Invalid variance: The type parameter 'T' must be invariantly valid on 'IM3.RefMethod()'. 'T' is covariant.
// interface IM3 { ref T RefMethod(); }
Diagnostic(ErrorCode.ERR_UnexpectedVariance, "ref T").WithArguments("IM3.RefMethod()", "T", "covariant", "invariantly").WithLocation(6, 24),
@@ -3265,7 +3265,7 @@ interface IP3f { ref Func RefProp{get;} }
";
- CreateCompilationWithMscorlib45AndCSharp(source).VerifyEmitDiagnostics(
+ CreateCompilationWithMscorlib461AndCSharp(source).VerifyEmitDiagnostics(
// (5,23): error CS1961: Invalid variance: The type parameter 'T' must be invariantly valid on 'IP2.RefProp'. 'T' is contravariant.
// interface IP2 { ref T RefProp{get;} }
Diagnostic(ErrorCode.ERR_UnexpectedVariance, "ref T").WithArguments("IP2.RefProp", "T", "contravariant", "invariantly").WithLocation(5, 23),
@@ -3308,7 +3308,7 @@ interface IP3f { ref Func this[int i]{get;} }
";
- CreateCompilationWithMscorlib45AndCSharp(source).VerifyEmitDiagnostics(
+ CreateCompilationWithMscorlib461AndCSharp(source).VerifyEmitDiagnostics(
// (6,24): error CS1961: Invalid variance: The type parameter 'T' must be invariantly valid on 'IP3.this[int]'. 'T' is covariant.
// interface IP3 { ref T this[int i]{get;} }
Diagnostic(ErrorCode.ERR_UnexpectedVariance, "ref T").WithArguments("IP3.this[int]", "T", "covariant", "invariantly").WithLocation(6, 24),
@@ -3355,7 +3355,7 @@ static void Main()
";
- CreateCompilationWithMscorlib45AndCSharp(source, parseOptions: TestOptions.WithoutImprovedOverloadCandidates).VerifyEmitDiagnostics(
+ CreateCompilationWithMscorlib461AndCSharp(source, parseOptions: TestOptions.WithoutImprovedOverloadCandidates).VerifyEmitDiagnostics(
// (10,30): error CS0407: 'string Program.M1()' has the wrong return type
// RefFunc1