From a74e81237ad734255df8eb63c0af44c0bb528317 Mon Sep 17 00:00:00 2001 From: Julien Couvreur Date: Mon, 17 Oct 2022 21:18:43 -0700 Subject: [PATCH] Make TargetFramework.NetCoreApp use Net70 --- .../CodeGen/CodeGenFunctionPointersTests.cs | 4 +- .../EditAndContinue/EditAndContinueTests.cs | 2 +- .../AttributeTests_CallerInfoAttributes.cs | 16 +-- .../Semantic/Semantics/InterpolationTests.cs | 82 +++++++------- .../RawInterpolationTests_Handler.cs | 46 ++++---- .../Test/Semantic/Semantics/RefFieldTests.cs | 2 +- .../DefaultInterfaceImplementationTests.cs | 80 +++++++------- .../Core/Compilation/CompilationExtensions.cs | 2 +- .../Test/Core/TargetFrameworkUtil.cs | 5 +- .../Test/Utilities/CSharp/CSharpTestBase.cs | 2 +- ...AttributeTests_CallerArgumentExpression.vb | 104 +++++++++--------- .../AttributeTests_UnmanagedCallersOnly.vb | 6 +- .../DefaultInterfaceImplementationTests.vb | 12 +- 13 files changed, 182 insertions(+), 181 deletions(-) diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenFunctionPointersTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenFunctionPointersTests.cs index d9b14bb7d5a4d..3fe6229f90f8f 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenFunctionPointersTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenFunctionPointersTests.cs @@ -45,7 +45,7 @@ private CompilationVerifier CompileAndVerifyFunctionPointers( private static CSharpCompilation CreateCompilationWithFunctionPointers(CSharpTestSource source, IEnumerable? references = null, CSharpCompilationOptions? options = null, TargetFramework? targetFramework = null) { - return CreateCompilation(source, references: references, options: options ?? TestOptions.UnsafeReleaseDll, parseOptions: TestOptions.Regular9, targetFramework: targetFramework ?? TargetFramework.NetCoreApp); + return CreateCompilation(source, references: references, options: options ?? TestOptions.UnsafeReleaseDll, parseOptions: TestOptions.Regular9, targetFramework: targetFramework ?? TargetFramework.Net50); } private CompilationVerifier CompileAndVerifyFunctionPointersWithIl(string source, string ilStub, Action? symbolValidator = null, string? expectedOutput = null) @@ -56,7 +56,7 @@ private CompilationVerifier CompileAndVerifyFunctionPointersWithIl(string source private static CSharpCompilation CreateCompilationWithFunctionPointersAndIl(string source, string ilStub, IEnumerable? references = null, CSharpCompilationOptions? options = null) { - return CreateCompilationWithIL(source, ilStub, references: references, options: options ?? TestOptions.UnsafeReleaseDll, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); + return CreateCompilationWithIL(source, ilStub, references: references, options: options ?? TestOptions.UnsafeReleaseDll, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Net50); } [Theory] diff --git a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs index dd46ff9d2e4eb..592775cd58d8b 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs @@ -5782,7 +5782,7 @@ interface I interface J { } }"; - var compilation0 = CreateCompilation(source0, parseOptions: TestOptions.Regular.WithNoRefSafetyRulesAttribute(), options: TestOptions.DebugDll, targetFramework: TargetFramework.NetCoreApp); + var compilation0 = CreateCompilation(source0, parseOptions: TestOptions.Regular.WithNoRefSafetyRulesAttribute(), options: TestOptions.DebugDll, targetFramework: TargetFramework.Net50); var compilation1 = compilation0.WithSource(source1); var compilation2 = compilation1.WithSource(source2); diff --git a/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_CallerInfoAttributes.cs b/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_CallerInfoAttributes.cs index 7167cebecbe11..2c87660e74f32 100644 --- a/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_CallerInfoAttributes.cs +++ b/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_CallerInfoAttributes.cs @@ -64,7 +64,7 @@ public static void Main() } "; - var compilation = CreateCompilation(source, targetFramework: TargetFramework.NetCoreApp, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); + var compilation = CreateCompilation(source, targetFramework: TargetFramework.Net50, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); // Begin/EndInvoke are not currently supported. CompileAndVerify(compilation).VerifyDiagnostics().VerifyIL("Program.Main", @" { @@ -130,7 +130,7 @@ public static void Main() } "; - var compilation = CreateCompilation(source, targetFramework: TargetFramework.NetCoreApp, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); + var compilation = CreateCompilation(source, targetFramework: TargetFramework.Net50, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); // Begin/EndInvoke are not currently supported. CompileAndVerify(compilation).VerifyDiagnostics().VerifyIL("Program.Main", @" { @@ -195,7 +195,7 @@ public static void Main() } "; - var compilation = CreateCompilation(source, targetFramework: TargetFramework.NetCoreApp, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); + var compilation = CreateCompilation(source, targetFramework: TargetFramework.Net50, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); compilation.VerifyDiagnostics( // (29,22): error CS8964: The CallerArgumentExpressionAttribute may only be applied to parameters with default values // delegate void D([CallerArgumentExpression(s5)] [Optional] [DefaultParameterValue("default")] ref string s1, string s2, string s3, string s4, string s5); @@ -310,7 +310,7 @@ public static void Main() } "; - var compilation = CreateCompilation(source, targetFramework: TargetFramework.NetCoreApp, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); + var compilation = CreateCompilation(source, targetFramework: TargetFramework.Net50, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); compilation.VerifyDiagnostics( // (29,33): error CS8964: The CallerArgumentExpressionAttribute may only be applied to parameters with default values // delegate void D(string s1, [CallerArgumentExpression(s1)] [Optional] [DefaultParameterValue("default")] ref string s2); @@ -367,7 +367,7 @@ public static void Main() } "; - var compilation = CreateCompilation(source, targetFramework: TargetFramework.NetCoreApp, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); + var compilation = CreateCompilation(source, targetFramework: TargetFramework.Net50, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); CompileAndVerify(compilation).VerifyDiagnostics( // (29,33): warning CS8963: The CallerArgumentExpressionAttribute applied to parameter 's2' will have no effect. It is applied with an invalid parameter name. // delegate void D(string s1, [CallerArgumentExpression(callback)] [Optional] [DefaultParameterValue("default")] string s2); @@ -1436,7 +1436,7 @@ public InterpolatedStringHandlerAttribute() } "; - var compilation = CreateCompilation(source, targetFramework: TargetFramework.NetCoreApp, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); + var compilation = CreateCompilation(source, targetFramework: TargetFramework.Net50, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); CompileAndVerify(compilation, expectedOutput: "1 + /**/ 1").VerifyDiagnostics(); } #endregion @@ -2436,7 +2436,7 @@ public static void Main() } "; - var compilation = CreateCompilation(source, targetFramework: TargetFramework.NetCoreApp, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); + var compilation = CreateCompilation(source, targetFramework: TargetFramework.Net50, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); CompileAndVerify(compilation).VerifyDiagnostics().VerifyIL("Program.Main", @" { // Code size 29 (0x1d) @@ -2487,7 +2487,7 @@ public static void Main() } "; - var compilation = CreateCompilation(source, targetFramework: TargetFramework.NetCoreApp, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); + var compilation = CreateCompilation(source, targetFramework: TargetFramework.Net50, options: TestOptions.ReleaseExe, parseOptions: TestOptions.Regular10); CompileAndVerify(compilation).VerifyDiagnostics().VerifyIL("Program.Main", @" { // Code size 29 (0x1d) diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs index 801c5ce8091b6..2a0d7b30d4893 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/InterpolationTests.cs @@ -2229,14 +2229,14 @@ public void UseOfSpanInInterpolationHole(bool useDefaultParameters, bool useBool string expectedIl = getIl(); - var verifier = CompileAndVerify(new[] { source, interpolatedStringBuilder }, expectedOutput: expectedOutput, targetFramework: TargetFramework.NetCoreApp, parseOptions: TestOptions.Regular10); + var verifier = CompileAndVerify(new[] { source, interpolatedStringBuilder }, expectedOutput: expectedOutput, targetFramework: TargetFramework.Net50, parseOptions: TestOptions.Regular10); verifier.VerifyIL("", expectedIl); - var comp1 = CreateCompilation(interpolatedStringBuilder, targetFramework: TargetFramework.NetCoreApp); + var comp1 = CreateCompilation(interpolatedStringBuilder, targetFramework: TargetFramework.Net50); foreach (var reference in new[] { comp1.EmitToImageReference(), comp1.ToMetadataReference() }) { - var comp2 = CreateCompilation(source, new[] { reference }, targetFramework: TargetFramework.NetCoreApp, parseOptions: TestOptions.Regular10); + var comp2 = CreateCompilation(source, new[] { reference }, targetFramework: TargetFramework.Net50, parseOptions: TestOptions.Regular10); verifier = CompileAndVerify(comp2, expectedOutput: expectedOutput); verifier.VerifyIL("", expectedIl); } @@ -5530,7 +5530,7 @@ public ref partial struct DefaultInterpolatedStringHandler GetInterpolatedStringHandlerDefinition(includeSpanOverloads: false, useDefaultParameters: true, useBoolReturns: false) }; - var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (3,11): error CS8773: Feature 'interpolated string handlers' is not available in C# 9.0. Please use language version 10.0 or greater. // C.M(() => $"{new S { Field = "Field" }}"); @@ -5540,7 +5540,7 @@ public ref partial struct DefaultInterpolatedStringHandler Diagnostic(ErrorCode.ERR_FeatureNotAvailableInVersion9, @"new S { Field = ""Field"" }").WithArguments("interpolated string handlers", "10.0").WithLocation(3, 14) ); - comp = CreateCompilation(source, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.NetCoreApp); + comp = CreateCompilation(source, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.Net50); var verifier = CompileAndVerifyOnCorrectPlatforms(comp, expectedOutput: @"value:Field"); verifier.VerifyIL(@"Program.<>c.<
$>b__0_0()", @" @@ -5655,7 +5655,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); var verifier = CompileAndVerifyOnCorrectPlatforms(comp, expectedOutput: @"1.00Literal"); verifier.VerifyIL(@"Program.<>c.<
$>b__0_0(bool)", !expression.Contains('+') ? @" @@ -5788,7 +5788,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (3,3): error CS0121: The call is ambiguous between the following methods or properties: 'C.M(Func)' and 'C.M(Func)' // C.M(b => @@ -5903,7 +5903,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); var verifier = CompileAndVerifyOnCorrectPlatforms(comp, expectedOutput: @"1.00Literal"); verifier.VerifyIL("", !expression.Contains('+') ? @" @@ -5974,7 +5974,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (4,19): error CS0029: Cannot implicitly convert type 'string' to 'CustomHandler' // CustomHandler x = (bool)(object)false ? default(CustomHandler) : $"{1,2:f}Literal"; @@ -6060,7 +6060,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (4,9): error CS0172: Type of conditional expression cannot be determined because 'CustomHandler' and 'string' implicitly convert to one another // var x = (bool)(object)false ? default(CustomHandler) : $"{1,2:f}Literal"; @@ -6087,7 +6087,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); VerifyInterpolatedStringExpression(comp); var verifier = CompileAndVerifyOnCorrectPlatforms(comp, expectedOutput: @" value:1 @@ -6144,7 +6144,7 @@ public void SwitchTypes_01(string expression) Console.WriteLine(x); "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (4,29): error CS8506: No best type was found for the switch expression. // var x = (bool)(object)false switch { true => default(CustomHandler), false => $"{1,2:f}Literal" }; @@ -6171,7 +6171,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); var verifier = CompileAndVerifyOnCorrectPlatforms(comp, expectedOutput: @"1.00Literal"); verifier.VerifyIL("", !expression.Contains('+') ? @" @@ -6379,7 +6379,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (4,29): error CS8506: No best type was found for the switch expression. // var x = (bool)(object)false switch { true => default(CustomHandler), false => $"{1,2:f}Literal" }; @@ -6506,7 +6506,7 @@ public void PassAsRefWithoutKeyword_02(string expression) void M(ref CustomHandler c) => System.Console.WriteLine(c);"; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "class", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "class", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (2,3): error CS1620: Argument 1 must be passed with the 'ref' keyword // M($"{1,2:f}Literal"); @@ -13455,10 +13455,10 @@ public static CustomHandler M() Diagnostic(ErrorCode.ERR_EscapeVariable, "s").WithArguments("s").WithLocation(17, 19) }; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(expectedDiagnostics); - comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.NetCoreApp); + comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(expectedDiagnostics); } @@ -13487,7 +13487,7 @@ public static CustomHandler M() } } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); } @@ -13524,10 +13524,10 @@ public static ref CustomHandler M() Diagnostic(ErrorCode.ERR_MustHaveRefReturn, "return").WithLocation(17, 9) }; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(expectedDiagnostics); - comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.NetCoreApp); + comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(expectedDiagnostics); } @@ -13564,10 +13564,10 @@ public static ref CustomHandler M() Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, expression).WithLocation(17, 20) }; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(expectedDiagnostics); - comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.NetCoreApp); + comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(expectedDiagnostics); } @@ -13604,7 +13604,7 @@ public ref struct S1 } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (17,9): error CS8350: This combination of arguments to 'CustomHandler.M2(ref S1, ref CustomHandler)' is disallowed because it may expose variables referenced by parameter 'handler' outside of their declaration scope // M2(ref s1, $"{s}"); @@ -13613,7 +13613,7 @@ public ref struct S1 // M2(ref s1, $"{s}"); Diagnostic(ErrorCode.ERR_EscapeVariable, "s").WithArguments("s").WithLocation(17, 23)); - comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.NetCoreApp); + comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (17,9): error CS8350: This combination of arguments to 'CustomHandler.M2(ref S1, ref CustomHandler)' is disallowed because it may expose variables referenced by parameter 'handler' outside of their declaration scope // M2(ref s1, $"{s}"); @@ -13662,10 +13662,10 @@ public ref struct S1 } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); - comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.NetCoreApp); + comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); } @@ -13696,10 +13696,10 @@ public CustomHandler(int literalLength, int formattedCount, Span s) : this } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); - comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.NetCoreApp); + comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); } @@ -13730,10 +13730,10 @@ public CustomHandler(int literalLength, int formattedCount, Span s) : this } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); - comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.NetCoreApp); + comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); } @@ -13767,7 +13767,7 @@ public static ref CustomHandler M2(ref Span s, [InterpolatedStringHandlerA } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular.WithLanguageVersion(languageVersion), targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular.WithLanguageVersion(languageVersion), targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (16,16): error CS8352: Cannot use variable 'c' in this context because it may expose referenced variables outside of their declaration scope // return c; @@ -13805,7 +13805,7 @@ public ref struct S1 public CustomHandler Handler; } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (15,9): error CS8350: This combination of arguments to 'CustomHandler.M2(ref S1, CustomHandler)' is disallowed because it may expose variables referenced by parameter 'handler' outside of their declaration scope // M2(ref s1, $"{s2}"); @@ -13815,7 +13815,7 @@ public ref struct S1 Diagnostic(ErrorCode.ERR_EscapeVariable, "s2").WithArguments("s2").WithLocation(15, 23) ); - comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular11, targetFramework: TargetFramework.NetCoreApp); + comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular11, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (10,100): error CS8352: Cannot use variable 'out CustomHandler' in this context because it may expose referenced variables outside of their declaration scope // public CustomHandler(int literalLength, int formattedCount, ref S1 s1) : this() { s1.Handler = this; } @@ -13860,10 +13860,10 @@ static void Main() static void M(ref S s, [InterpolatedStringHandlerArgument(""s"")] CustomHandler handler) { } }"; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular10, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); - comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular11, targetFramework: TargetFramework.NetCoreApp); + comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, parseOptions: TestOptions.Regular11, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (5,97): error CS8352: Cannot use variable 'out CustomHandler' in this context because it may expose referenced variables outside of their declaration scope // public CustomHandler(int literalLength, int formattedCount, ref S s) : this() { s.Handler = this; } @@ -13908,7 +13908,7 @@ static void F2() static void M(ref CustomHandler handler) { } } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, parseOptions: TestOptions.Regular.WithLanguageVersion(languageVersion), targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, parseOptions: TestOptions.Regular.WithLanguageVersion(languageVersion), targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (20,9): error CS8350: This combination of arguments to 'CustomHandler.AppendFormatted(Span)' is disallowed because it may expose variables referenced by parameter 's' outside of their declaration scope // h2.AppendFormatted(s); // 1 @@ -13949,7 +13949,7 @@ static void F2() static void M(ref CustomHandler handler) { } } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); } @@ -13985,7 +13985,7 @@ static CustomHandler F2() } } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, parseOptions: TestOptions.Regular.WithLanguageVersion(languageVersion), targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, parseOptions: TestOptions.Regular.WithLanguageVersion(languageVersion), targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (15,16): error CS8352: Cannot use variable 'h1' in this context because it may expose referenced variables outside of their declaration scope // return h1; // 1 @@ -14036,7 +14036,7 @@ static CustomHandler F3() } } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (29,16): error CS8352: Cannot use variable 'h3' in this context because it may expose referenced variables outside of their declaration scope // return h3; // 1 @@ -14082,7 +14082,7 @@ static CustomHandler F4() } "; // https://github.com/dotnet/roslyn/issues/63306: Should report an error in each case. - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, parseOptions: TestOptions.Regular.WithLanguageVersion(languageVersion), targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, parseOptions: TestOptions.Regular.WithLanguageVersion(languageVersion), targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); } @@ -14122,7 +14122,7 @@ static CustomHandler F4() } } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); } diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/RawInterpolationTests_Handler.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/RawInterpolationTests_Handler.cs index 58cddeac43862..4caa953e70f09 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/RawInterpolationTests_Handler.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/RawInterpolationTests_Handler.cs @@ -624,14 +624,14 @@ public void UseOfSpanInInterpolationHole(bool useDefaultParameters, bool useBool string expectedIl = getIl(); - var verifier = CompileAndVerify(new[] { source, interpolatedStringBuilder }, expectedOutput: expectedOutput, targetFramework: TargetFramework.NetCoreApp, parseOptions: TestOptions.RegularPreview); + var verifier = CompileAndVerify(new[] { source, interpolatedStringBuilder }, expectedOutput: expectedOutput, targetFramework: TargetFramework.Net50, parseOptions: TestOptions.RegularPreview); verifier.VerifyIL("", expectedIl); - var comp1 = CreateCompilation(interpolatedStringBuilder, targetFramework: TargetFramework.NetCoreApp); + var comp1 = CreateCompilation(interpolatedStringBuilder, targetFramework: TargetFramework.Net50); foreach (var reference in new[] { comp1.EmitToImageReference(), comp1.ToMetadataReference() }) { - var comp2 = CreateCompilation(source, new[] { reference }, targetFramework: TargetFramework.NetCoreApp, parseOptions: TestOptions.RegularPreview); + var comp2 = CreateCompilation(source, new[] { reference }, targetFramework: TargetFramework.Net50, parseOptions: TestOptions.RegularPreview); verifier = CompileAndVerify(comp2, expectedOutput: expectedOutput); verifier.VerifyIL("", expectedIl); } @@ -3769,7 +3769,7 @@ public ref partial struct DefaultInterpolatedStringHandler GetInterpolatedStringHandlerDefinition(includeSpanOverloads: false, useDefaultParameters: true, useBoolReturns: false) }; - var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(source, parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Net50); if (expression.Contains('+')) { @@ -3912,7 +3912,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); var verifier = CompileAndVerifyOnCorrectPlatforms(comp, expectedOutput: @"1.00Literal"); verifier.VerifyIL(@"Program.<>c.<
$>b__0_0(bool)", !expression.Contains('+') ? @" @@ -4045,7 +4045,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (3,3): error CS0121: The call is ambiguous between the following methods or properties: 'C.M(Func)' and 'C.M(Func)' // C.M(b => @@ -4183,7 +4183,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); var verifier = CompileAndVerifyOnCorrectPlatforms(comp, expectedOutput: @"1.00Literal"); verifier.VerifyIL("", !expression.Contains('+') ? @" @@ -4254,7 +4254,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (4,19): error CS0029: Cannot implicitly convert type 'string' to 'CustomHandler' // CustomHandler x = (bool)(object)false ? default(CustomHandler) : $"{1,2:f}Literal"; @@ -4339,7 +4339,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (4,9): error CS0172: Type of conditional expression cannot be determined because 'CustomHandler' and 'string' implicitly convert to one another // var x = (bool)(object)false ? default(CustomHandler) : $"{1,2:f}Literal"; @@ -4422,7 +4422,7 @@ public void SwitchTypes_01(string expression) Console.WriteLine(x); "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (4,29): error CS8506: No best type was found for the switch expression. // var x = (bool)(object)false switch { true => default(CustomHandler), false => $"{1,2:f}Literal" }; @@ -4448,7 +4448,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); var verifier = CompileAndVerifyOnCorrectPlatforms(comp, expectedOutput: @"1.00Literal"); verifier.VerifyIL("", !expression.Contains('+') ? @" @@ -4656,7 +4656,7 @@ public partial struct CustomHandler } "; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "partial struct", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (4,29): error CS8506: No best type was found for the switch expression. // var x = (bool)(object)false switch { true => default(CustomHandler), false => $"{1,2:f}Literal" }; @@ -4782,7 +4782,7 @@ public void PassAsRefWithoutKeyword_02(string expression) void M(ref CustomHandler c) => System.Console.WriteLine(c);"; - var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "class", useBoolReturns: false) }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, GetInterpolatedStringCustomHandlerType("CustomHandler", "class", useBoolReturns: false) }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (2,3): error CS1620: Argument 1 must be passed with the 'ref' keyword // M($"{1,2:f}Literal"); @@ -10981,7 +10981,7 @@ public static CustomHandler M() } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (17,19): error CS8352: Cannot use variable 's' in this context because it may expose referenced variables outside of their declaration scope // return $"{s}"; @@ -11016,7 +11016,7 @@ public static ref CustomHandler M() } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (17,9): error CS8150: By-value returns may only be used in methods that return by value // return $"{s}"; @@ -11051,7 +11051,7 @@ public static ref CustomHandler M() } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (17,20): error CS8156: An expression cannot be used in this context because it may not be passed or returned by reference // return ref $"{s}"; @@ -11093,7 +11093,7 @@ public ref struct S1 } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (17,9): error CS8350: This combination of arguments to 'CustomHandler.M2(ref S1, ref CustomHandler)' is disallowed because it may expose variables referenced by parameter 'handler' outside of their declaration scope // M2(ref s1, $"""{s}""" + $""" @@ -11138,7 +11138,7 @@ public ref struct S1 } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); } @@ -11171,7 +11171,7 @@ public CustomHandler(int literalLength, int formattedCount, Span s) : this } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); } @@ -11204,7 +11204,7 @@ public CustomHandler(int literalLength, int formattedCount, Span s) : this } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics(); } @@ -11238,7 +11238,7 @@ public static ref CustomHandler M2(ref Span s, [InterpolatedStringHandlerA } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (18,16): error CS8352: Cannot use variable 'c' in this context because it may expose referenced variables outside of their declaration scope // return c; @@ -11276,7 +11276,7 @@ public ref struct S1 } "; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (10,107): error CS8352: Cannot use variable 'out CustomHandler' in this context because it may expose referenced variables outside of their declaration scope // public CustomHandler(int literalLength, int formattedCount, scoped ref S1 s1) : this() { s1.Handler = this; } @@ -11314,7 +11314,7 @@ static void Main() static void M(ref S s, [InterpolatedStringHandlerArgument(""s"")] CustomHandler handler) { } }"; - var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.NetCoreApp); + var comp = CreateCompilation(new[] { code, InterpolatedStringHandlerAttribute, InterpolatedStringHandlerArgumentAttribute }, targetFramework: TargetFramework.Net50); comp.VerifyDiagnostics( // (5,104): error CS8352: Cannot use variable 'out CustomHandler' in this context because it may expose referenced variables outside of their declaration scope // public CustomHandler(int literalLength, int formattedCount, scoped ref S s) : this() { s.Handler = this; } diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/RefFieldTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/RefFieldTests.cs index 6bd94cd0af17c..2f1cbe8921810 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/RefFieldTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/RefFieldTests.cs @@ -22436,7 +22436,7 @@ void Test() Span GetSpan() => default; } "; - var comp = CreateCompilation(new[] { source, UnscopedRefAttributeDefinition }, targetFramework: TargetFramework.NetCoreApp, options: TestOptions.ReleaseDll); + var comp = CreateCompilation(new[] { source, UnscopedRefAttributeDefinition }, targetFramework: TargetFramework.Net50, options: TestOptions.ReleaseDll); comp.VerifyDiagnostics( ); } diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs index 2b54f9d9d1565..0199f24e950fe 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs @@ -12034,7 +12034,7 @@ void I1.M1() "; var compilation1 = CreateCompilation(source1 + source2, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net50); compilation1.VerifyDiagnostics(); @@ -12044,7 +12044,7 @@ void I1.M1() var compilation2 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net50); compilation2.VerifyDiagnostics(); @@ -12095,7 +12095,7 @@ void I1.M1() "; var compilation1 = CreateCompilation(source1 + source2, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net50); compilation1.VerifyDiagnostics(); @@ -12105,7 +12105,7 @@ void I1.M1() var compilation2 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net50); compilation2.VerifyDiagnostics(); @@ -12156,7 +12156,7 @@ void I1.M1() "; var compilation1 = CreateCompilation(source1 + source2, options: TestOptions.DebugExe, parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net50); compilation1.VerifyDiagnostics(); @@ -12166,7 +12166,7 @@ void I1.M1() var compilation2 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net50); compilation2.VerifyDiagnostics(); @@ -45657,13 +45657,13 @@ public class Test1 : I1 "; var compilation0 = CreateCompilation(source0, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net50); compilation0.VerifyDiagnostics(); var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll, parseOptions: TestOptions.Regular, - targetFramework: TargetFramework.NetCoreApp); + targetFramework: TargetFramework.Net50); Assert.True(compilation1.Assembly.RuntimeSupportsDefaultInterfaceImplementation); compilation1.VerifyDiagnostics(); @@ -50163,7 +50163,7 @@ public TypeIdentifierAttribute(string scope, string identifier){} [Fact] public void NoPia_01() { - var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.NetCoreApp); + var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.Net50); var attributesRef = attributes.EmitToImageReference(); string pia = @" @@ -50182,7 +50182,7 @@ void M1(){} } "; - var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.Net50); string consumer = @" class UsePia7 : ITest33 @@ -50190,7 +50190,7 @@ class UsePia7 : ITest33 } "; - var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), attributesRef }, targetFramework: TargetFramework.Net50); compilation1.VerifyEmitDiagnostics( // (2,17): error CS8711: Type 'ITest33' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false. @@ -50202,7 +50202,7 @@ class UsePia7 : ITest33 [Fact] public void NoPia_02() { - var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.NetCoreApp); + var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.Net50); var attributesRef = attributes.EmitToImageReference(); string pia = @" @@ -50221,7 +50221,7 @@ void M1(){} } "; - var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.Net50); string consumer = @" class UsePia @@ -50233,7 +50233,7 @@ public static void Main(ITest33 x) } "; - var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), attributesRef }, targetFramework: TargetFramework.Net50); compilation1.VerifyEmitDiagnostics( // (4,29): error CS8711: Type 'ITest33' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false. @@ -50245,7 +50245,7 @@ public static void Main(ITest33 x) [Fact] public void NoPia_03() { - var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.NetCoreApp); + var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.Net50); var attributesRef = attributes.EmitToImageReference(); string pia = @" @@ -50265,7 +50265,7 @@ void M1(){} } "; - var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.Net50); string consumer = @" class UsePia @@ -50277,7 +50277,7 @@ public static void Main(ITest33 x) } "; - var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), attributesRef }, targetFramework: TargetFramework.Net50); compilation1.VerifyEmitDiagnostics( // (4,29): error CS8711: Type 'ITest33' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false. @@ -50289,7 +50289,7 @@ public static void Main(ITest33 x) [Fact] public void NoPia_04() { - var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.NetCoreApp); + var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.Net50); var attributesRef = attributes.EmitToImageReference(); string pia = @" @@ -50308,7 +50308,7 @@ sealed void M1(){} } "; - var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.Net50); string consumer = @" class UsePia @@ -50320,7 +50320,7 @@ public static void Main(ITest33 x) } "; - var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), attributesRef }, targetFramework: TargetFramework.Net50); compilation1.VerifyEmitDiagnostics( // (4,29): error CS8711: Type 'ITest33' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false. @@ -50332,7 +50332,7 @@ public static void Main(ITest33 x) [Fact] public void NoPia_05() { - var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.NetCoreApp); + var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.Net50); var attributesRef = attributes.EmitToImageReference(); string pia = @" @@ -50351,7 +50351,7 @@ static void M1(){} } "; - var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.Net50); string consumer = @" class UsePia @@ -50363,7 +50363,7 @@ public static void Main() } "; - var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), attributesRef }, targetFramework: TargetFramework.Net50); compilation1.VerifyEmitDiagnostics( // (6,9): error CS8711: Type 'ITest33' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false. @@ -50375,7 +50375,7 @@ public static void Main() [Fact] public void NoPia_06() { - var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.NetCoreApp); + var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.Net50); var attributesRef = attributes.EmitToImageReference(); string pia = @" @@ -50398,7 +50398,7 @@ public interface I1 } "; - var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.Net50); CompileAndVerify(piaCompilation, verify: VerifyOnMonoOrCoreClr); @@ -50413,7 +50413,7 @@ public static void Main(ITest33.I1 x) foreach (var reference in new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), piaCompilation.EmitToImageReference(embedInteropTypes: true) }) { - var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { reference, attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { reference, attributesRef }, targetFramework: TargetFramework.Net50); compilation1.VerifyEmitDiagnostics( // (4,37): error CS1754: Type 'ITest33.I1' cannot be embedded because it is a nested type. Consider setting the 'Embed Interop Types' property to false. @@ -50426,7 +50426,7 @@ public static void Main(ITest33.I1 x) [Fact] public void NoPia_07() { - var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.NetCoreApp); + var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.Net50); var attributesRef = attributes.EmitToImageReference(); string pia = @" @@ -50445,7 +50445,7 @@ public interface ITest33 } "; - var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.Net50); CompileAndVerify(piaCompilation, verify: VerifyOnMonoOrCoreClr); @@ -50461,7 +50461,7 @@ public static void Main() foreach (var reference in new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), piaCompilation.EmitToImageReference(embedInteropTypes: true) }) { - var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { reference, attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { reference, attributesRef }, targetFramework: TargetFramework.Net50); compilation1.VerifyEmitDiagnostics( // (6,13): error CS8711: Type 'ITest33' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false. @@ -50474,7 +50474,7 @@ public static void Main() [Fact] public void NoPia_08() { - var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.NetCoreApp); + var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.Net50); var attributesRef = attributes.EmitToImageReference(); string pia = @" @@ -50500,7 +50500,7 @@ void ITest33.M1(){} } "; - var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.Net50); string consumer = @" class UsePia @@ -50512,7 +50512,7 @@ public static void Main(ITest44 x) } "; - var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), attributesRef }, targetFramework: TargetFramework.Net50); compilation1.VerifyEmitDiagnostics( // (4,29): error CS8711: Type 'ITest44' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false. @@ -50524,7 +50524,7 @@ public static void Main(ITest44 x) [ConditionalFact(typeof(WindowsOnly), Reason = ConditionalSkipReason.NoPiaNeedsDesktop)] public void NoPia_09() { - var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.NetCoreApp); + var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.Net50); var attributesRef = attributes.EmitToImageReference(); string pia = @" @@ -50555,7 +50555,7 @@ void ITest33.M1(){} } "; - var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.Net50); string consumer1 = @" public class UsePia @@ -50615,7 +50615,7 @@ public interface ITest33 [WorkItem(35911, "https://github.com/dotnet/roslyn/issues/35911")] public void NoPia_10() { - var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.NetCoreApp); + var attributes = CreateCompilation(NoPiaAttributes, options: TestOptions.ReleaseDll, targetFramework: TargetFramework.Net50); var attributesRef = attributes.EmitToImageReference(); string pia = @" @@ -50641,7 +50641,7 @@ public interface ITest44 : ITest33 } "; - var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var piaCompilation = CreateCompilation(pia, options: TestOptions.ReleaseDll, references: new[] { attributesRef }, targetFramework: TargetFramework.Net50); CompileAndVerify(piaCompilation, verify: VerifyOnMonoOrCoreClr); @@ -50657,7 +50657,7 @@ public static void Main(ITest44 x) foreach (var reference in new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), piaCompilation.EmitToImageReference(embedInteropTypes: true) }) { - var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { reference, attributesRef }, targetFramework: TargetFramework.NetCoreApp); + var compilation1 = CreateCompilation(consumer, options: TestOptions.ReleaseDll, references: new[] { reference, attributesRef }, targetFramework: TargetFramework.Net50); compilation1.VerifyEmitDiagnostics( // (4,29): error CS8750: Type 'ITest44' cannot be embedded because it has a re-abstraction of a member from base interface. Consider setting the 'Embed Interop Types' property to false. @@ -50693,7 +50693,7 @@ static void Main() } "; - var compilation0 = CreateCompilation(source0, options: TestOptions.DebugExe, targetFramework: TargetFramework.NetCoreApp); + var compilation0 = CreateCompilation(source0, options: TestOptions.DebugExe, targetFramework: TargetFramework.Net50); compilation0.VerifyDiagnostics(); var verifier = CompileAndVerify(compilation0, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : @"M1", verify: VerifyOnMonoOrCoreClr); @@ -50746,7 +50746,7 @@ static void Main() } "; - var compilation0 = CreateCompilation(source0, options: TestOptions.DebugExe, targetFramework: TargetFramework.NetCoreApp); + var compilation0 = CreateCompilation(source0, options: TestOptions.DebugExe, targetFramework: TargetFramework.Net50); compilation0.VerifyDiagnostics(); var verifier = CompileAndVerify(compilation0, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : @"M1", verify: VerifyOnMonoOrCoreClr); @@ -50799,7 +50799,7 @@ static void Main() } "; - var compilation0 = CreateCompilation(source0, options: TestOptions.DebugExe, targetFramework: TargetFramework.NetCoreApp); + var compilation0 = CreateCompilation(source0, options: TestOptions.DebugExe, targetFramework: TargetFramework.Net50); compilation0.VerifyDiagnostics(); var verifier = CompileAndVerify(compilation0, expectedOutput: !ExecutionConditionUtil.IsMonoOrCoreClr ? null : @"A", verify: VerifyOnMonoOrCoreClr); diff --git a/src/Compilers/Test/Core/Compilation/CompilationExtensions.cs b/src/Compilers/Test/Core/Compilation/CompilationExtensions.cs index bef40eec7af14..79e556825e207 100644 --- a/src/Compilers/Test/Core/Compilation/CompilationExtensions.cs +++ b/src/Compilers/Test/Core/Compilation/CompilationExtensions.cs @@ -434,7 +434,7 @@ public static void RemoveEventHandler(Action removeMe var compilation = CSharpCompilation.Create( "System.Runtime.InteropServices.WindowsRuntime", new[] { CSharpSyntaxTree.ParseText(SourceText.From(source, encoding: null, SourceHashAlgorithms.Default)) }, - references: TargetFrameworkUtil.GetReferences(TargetFramework.NetCoreApp), + references: TargetFrameworkUtil.GetReferences(TargetFramework.Net50), options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); compilation.VerifyEmitDiagnostics(); return compilation.EmitToPortableExecutableReference(); diff --git a/src/Compilers/Test/Core/TargetFrameworkUtil.cs b/src/Compilers/Test/Core/TargetFrameworkUtil.cs index f3ed7daaa4cb9..79de3d6d92e04 100644 --- a/src/Compilers/Test/Core/TargetFrameworkUtil.cs +++ b/src/Compilers/Test/Core/TargetFrameworkUtil.cs @@ -179,11 +179,12 @@ public static class TargetFrameworkUtil public static ImmutableArray GetReferences(TargetFramework targetFramework) => targetFramework switch { // Primary + // Note: NetCoreApp should behave like latest Core TFM TargetFramework.Empty => ImmutableArray.Empty, TargetFramework.NetStandard20 => NetStandard20References, - TargetFramework.NetCoreApp or TargetFramework.Net50 => NetCoreApp.StandardReferences, + TargetFramework.Net50 => NetCoreApp.StandardReferences, TargetFramework.Net60 => ImmutableArray.CreateRange(Net60.All), - TargetFramework.Net70 => ImmutableArray.CreateRange(Net70.All), + TargetFramework.NetCoreApp or TargetFramework.Net70 => ImmutableArray.CreateRange(Net70.All), TargetFramework.NetCoreAppAndCSharp => NetCoreApp.StandardReferences.Add(NetCoreApp.MicrosoftCSharp), TargetFramework.NetFramework => NetFramework.StandardReferences, diff --git a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs index 3e588214e6d34..fc524399358c5 100644 --- a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs +++ b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs @@ -2454,7 +2454,7 @@ protected static CSharpCompilation CreateCompilationWithSpanAndMemoryExtensions( { if (ExecutionConditionUtil.IsCoreClr) { - return CreateCompilation(text, targetFramework: TargetFramework.NetCoreApp, references: new[] { Basic.Reference.Assemblies.Net50.SystemMemory }, options: options, parseOptions: parseOptions); + return CreateCompilation(text, targetFramework: TargetFramework.Net50, references: new[] { Basic.Reference.Assemblies.Net50.SystemMemory }, options: options, parseOptions: parseOptions); } else { diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_CallerArgumentExpression.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_CallerArgumentExpression.vb index dd7bf971417da..01d899b9c8dc1 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_CallerArgumentExpression.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_CallerArgumentExpression.vb @@ -30,7 +30,7 @@ Module Program End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="123").VerifyDiagnostics() End Sub @@ -51,7 +51,7 @@ Module Program End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.Regular16) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.Regular16) CompileAndVerify(compilation, expectedOutput:="123").VerifyDiagnostics() End Sub @@ -88,7 +88,7 @@ Class Program End Class " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="456").VerifyDiagnostics() End Sub @@ -125,7 +125,7 @@ Class Program End Class " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="").VerifyDiagnostics() End Sub @@ -146,7 +146,7 @@ Public Module Program2 End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="123").VerifyDiagnostics().VerifyTypeIL("Program2", " .class public auto ansi sealed Program2 extends [System.Runtime]System.Object @@ -191,7 +191,7 @@ End Module } // end of method Program2::Log } // end of class Program2 ") - Dim csCompilation = CreateCSharpCompilation("Program2.Log(5 + 2);", referencedAssemblies:=TargetFrameworkUtil.GetReferences(TargetFramework.NetCoreApp, {compilation.EmitToImageReference()}), compilationOptions:=New CSharp.CSharpCompilationOptions(OutputKind.ConsoleApplication)) + Dim csCompilation = CreateCSharpCompilation("Program2.Log(5 + 2);", referencedAssemblies:=TargetFrameworkUtil.GetReferences(TargetFramework.Net50, {compilation.EmitToImageReference()}), compilationOptions:=New CSharp.CSharpCompilationOptions(OutputKind.ConsoleApplication)) CompileAndVerify(csCompilation, expectedOutput:="5 + 2").VerifyDiagnostics() End Sub @@ -278,7 +278,7 @@ Module Program End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="123 + _ 5").VerifyDiagnostics() End Sub @@ -300,7 +300,7 @@ Module Program End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="124, 123, 124").VerifyDiagnostics() End Sub @@ -317,7 +317,7 @@ Public Module FromFirstAssembly End Sub End Module " - Dim comp1 = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, parseOptions:=TestOptions.Regular16_9) + Dim comp1 = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, parseOptions:=TestOptions.Regular16_9) comp1.VerifyDiagnostics() Dim ref1 = comp1.EmitToImageReference() @@ -329,7 +329,7 @@ Module Program End Module " - Dim compilation = CreateCompilation(source2, references:={ref1, Net451.MicrosoftVisualBasic}, targetFramework:=TargetFramework.NetCoreApp, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source2, references:={ref1, Net451.MicrosoftVisualBasic}, targetFramework:=TargetFramework.Net50, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="2 + 2").VerifyDiagnostics() End Sub @@ -352,7 +352,7 @@ Module Program End Sub End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="myIntegerExpression").VerifyDiagnostics() End Sub @@ -375,7 +375,7 @@ Module Program End Sub End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="myIntegerExpression * 2").VerifyDiagnostics() End Sub @@ -398,7 +398,7 @@ Module Program End Sub End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="") compilation.AssertTheseDiagnostics( ") compilation.AssertTheseDiagnostics( ").VerifyDiagnostics() End Sub @@ -859,7 +859,7 @@ Module Program End Sub End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:=" value") compilation.AssertTheseDiagnostics( @@ -931,7 +931,7 @@ Module Program End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseDll, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseDll, parseOptions:=TestOptions.RegularLatest) compilation.AssertTheseDiagnostics() End Sub @@ -952,7 +952,7 @@ Module Program End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="1 + 1").VerifyDiagnostics() End Sub #End Region @@ -978,7 +978,7 @@ Public Module Program End Sub End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="123").VerifyDiagnostics() End Sub @@ -1004,7 +1004,7 @@ Public Module Program End Sub End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="123 _ ' comment + 5").VerifyDiagnostics() End Sub @@ -1021,7 +1021,7 @@ Public Class MyAttribute : Inherits Attribute End Sub End Class " - Dim comp1 = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp) + Dim comp1 = CreateCompilation(source, targetFramework:=TargetFramework.Net50) comp1.VerifyDiagnostics() Dim ref1 = comp1.EmitToImageReference() @@ -1035,7 +1035,7 @@ Public Module Program End Sub End Module " - Dim compilation = CreateCompilation(source2, references:={ref1, Net451.MicrosoftVisualBasic}, targetFramework:=TargetFramework.NetCoreApp, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source2, references:={ref1, Net451.MicrosoftVisualBasic}, targetFramework:=TargetFramework.Net50, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="2 + 2").VerifyDiagnostics() End Sub @@ -1059,7 +1059,7 @@ Public Module Program End Sub End Module " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="") compilation.AssertTheseDiagnostics( ', ''").VerifyDiagnostics() End Sub #End Region @@ -1193,7 +1193,7 @@ Class Program End Sub End Class " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation, expectedOutput:="2, 1+ 1 4, explicit-value").VerifyDiagnostics() End Sub @@ -1218,7 +1218,7 @@ Class Program End Sub End Class " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) CompileAndVerify(compilation).VerifyDiagnostics().VerifyIL("Program.Main", " { // Code size 27 (0x1b) @@ -1257,7 +1257,7 @@ Class Program End Sub End Class " - Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) + Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.Net50, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.RegularLatest) compilation.AssertTheseDiagnostics( - Dim comp = CreateCompilation(source, references:={NetCoreApp.SystemRuntimeInteropServices}, targetFramework:=TargetFramework.NetCoreApp) + Dim comp = CreateCompilation(source, references:={NetCoreApp.SystemRuntimeInteropServices}, targetFramework:=TargetFramework.Net50) comp.AssertTheseDiagnostics( - Dim comp = CreateCompilation(source, references:={NetCoreApp.SystemRuntimeInteropServices, reference}, targetFramework:=TargetFramework.NetCoreApp) + Dim comp = CreateCompilation(source, references:={NetCoreApp.SystemRuntimeInteropServices, reference}, targetFramework:=TargetFramework.Net50) comp.AssertTheseDiagnostics( Public Sub NoPia_06() - Dim attributesRef = GetCSharpCompilation(NoPiaAttributes).EmitToImageReference() + Dim attributesRef = GetCSharpCompilation(NoPiaAttributes, targetFramework:=TargetFramework.Net50).EmitToImageReference() Dim csSource = " @@ -1932,7 +1932,7 @@ public interface ITest33 } " - Dim csCompilation = GetCSharpCompilation(csSource, {attributesRef}).EmitToImageReference(embedInteropTypes:=True) + Dim csCompilation = GetCSharpCompilation(csSource, {attributesRef}, targetFramework:=TargetFramework.Net50).EmitToImageReference(embedInteropTypes:=True) Dim source1 = @@ -1956,7 +1956,7 @@ BC31558: Nested type 'ITest33.I1' cannot be embedded. Public Sub NoPia_07() - Dim attributesRef = GetCSharpCompilation(NoPiaAttributes).EmitToImageReference() + Dim attributesRef = GetCSharpCompilation(NoPiaAttributes, targetFramework:=TargetFramework.Net50).EmitToImageReference() Dim csSource = " @@ -1975,7 +1975,7 @@ public interface ITest33 } " - Dim csCompilation = GetCSharpCompilation(csSource, {attributesRef}).EmitToImageReference(embedInteropTypes:=True) + Dim csCompilation = GetCSharpCompilation(csSource, {attributesRef}, targetFramework:=TargetFramework.Net50).EmitToImageReference(embedInteropTypes:=True) Dim source1 = @@ -2001,7 +2001,7 @@ BC37307: Type 'ITest33' cannot be embedded because it has a non-abstract member. Public Sub NoPia_10() - Dim attributesRef = GetCSharpCompilation(NoPiaAttributes).EmitToImageReference() + Dim attributesRef = GetCSharpCompilation(NoPiaAttributes, targetFramework:=TargetFramework.Net50).EmitToImageReference() Dim csSource = " @@ -2027,7 +2027,7 @@ public interface ITest44 : ITest33 } " - Dim csCompilation = GetCSharpCompilation(csSource, {attributesRef}).EmitToImageReference(embedInteropTypes:=True) + Dim csCompilation = GetCSharpCompilation(csSource, {attributesRef}, targetFramework:=TargetFramework.Net50).EmitToImageReference(embedInteropTypes:=True) Dim source1 =