提交 193229b8 编写于 作者: V vsadov

CR feedback

上级 7e7ea6a9
......@@ -1462,18 +1462,18 @@ internal enum ErrorCode
ERR_Merge_conflict_marker_encountered = 8300,
ERR_RefReadonlyNotField = 8206,
ERR_RefReadonlyNotField2 = 8207,
ERR_AssignReadonlyNotField = 8208,
ERR_AssignReadonlyNotField2 = 8209,
ERR_RefReturnReadonlyNotField = 8210,
ERR_RefReturnReadonlyNotField2 = 8211,
//PROTOTYPE(ReadonlyRefs): make err IDs contiguous before merging to master.
// For now it is more convenient to have a gap to avoid conflicts with other added errors
ERR_RefConditionalAndAwait = 8401,
ERR_RefConditionalNeedsTwoRefs = 8402,
ERR_RefConditionalDifferentTypes = 8403,
ERR_BadParameterModifiers = 8404,
ERR_RefReadonlyNotField = 8406,
ERR_RefReadonlyNotField2 = 8407,
ERR_AssignReadonlyNotField = 8408,
ERR_AssignReadonlyNotField2 = 8409,
ERR_RefReturnReadonlyNotField = 8410,
ERR_RefReturnReadonlyNotField2 = 8411,
}
}
\ No newline at end of file
......@@ -805,34 +805,34 @@ public struct S
}";
var comp = CreateCompilationWithMscorlib(text, references: s_attributeRefs);
comp.VerifyDiagnostics(
// (31,2): error CS8208: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// (31,2): error CS8408: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// [TupleElementNames(new[] { "a", "b" })]
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, @"TupleElementNames(new[] { ""a"", ""b"" })").WithLocation(31, 2),
// (5,2): error CS8208: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// (5,2): error CS8408: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// [TupleElementNames(new[] { "a", "b" })]
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, @"TupleElementNames(new[] { ""a"", ""b"" })").WithLocation(5, 2),
// (18,10): error CS8208: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// (18,10): error CS8408: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// [TupleElementNames(new[] { "x" })]ValueTuple<T> args);
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, @"TupleElementNames(new[] { ""x"" })").WithLocation(18, 10),
// (11,6): error CS8208: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// (11,6): error CS8408: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// [TupleElementNames(new[] { "x", "y" })]
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, @"TupleElementNames(new[] { ""x"", ""y"" })").WithLocation(11, 6),
// (14,14): error CS8208: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// (14,14): error CS8408: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// [return: TupleElementNames(new string[] { null, null })]
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, "TupleElementNames(new string[] { null, null })").WithLocation(14, 14),
// (15,36): error CS8208: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// (15,36): error CS8408: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// public ValueTuple<int, int> M([TupleElementNames(new string[] { null})] ValueTuple x) => (0, 0);
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, "TupleElementNames(new string[] { null})").WithLocation(15, 36),
// (20,6): error CS0592: Attribute 'TupleElementNames' is not valid on this declaration type. It is only valid on 'class, struct, property, indexer, field, parameter, return' declarations.
// [TupleElementNames(new[] { "y" })]
Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "TupleElementNames").WithArguments("TupleElementNames", "class, struct, property, indexer, field, parameter, return").WithLocation(20, 6),
// (27,6): error CS8208: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// (27,6): error CS8408: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// [TupleElementNames(new[] { "a", "b" })]
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, @"TupleElementNames(new[] { ""a"", ""b"" })").WithLocation(27, 6),
// (28,33): error CS8208: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// (28,33): error CS8408: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// public (int x, int y) this[[TupleElementNames](int a, int b) t] => t;
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, "TupleElementNames").WithLocation(28, 33),
// (8,6): error CS8208: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// (8,6): error CS8408: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
// [TupleElementNames(new string[] { null, null })]
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, "TupleElementNames(new string[] { null, null })").WithLocation(8, 6));
}
......
......@@ -121,22 +121,22 @@ static void M(in int arg1, in (int Alice, int Bob) arg2)
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,9): error CS8208: Cannot assign to variable 'ref readonly int' because it is a readonly variable
// (6,9): error CS8408: Cannot assign to variable 'ref readonly int' because it is a readonly variable
// arg1 = 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "arg1").WithArguments("variable", "ref readonly int").WithLocation(6, 9),
// (7,9): error CS8209: Cannot assign to a member of variable 'ref readonly (int Alice, int Bob)' because it is a readonly variable
// (7,9): error CS8409: Cannot assign to a member of variable 'ref readonly (int Alice, int Bob)' because it is a readonly variable
// arg2.Alice = 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "arg2.Alice").WithArguments("variable", "ref readonly (int Alice, int Bob)").WithLocation(7, 9),
// (9,9): error CS8208: Cannot assign to variable 'ref readonly int' because it is a readonly variable
// (9,9): error CS8408: Cannot assign to variable 'ref readonly int' because it is a readonly variable
// arg1 ++;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "arg1").WithArguments("variable", "ref readonly int").WithLocation(9, 9),
// (10,9): error CS8209: Cannot assign to a member of variable 'ref readonly (int Alice, int Bob)' because it is a readonly variable
// (10,9): error CS8409: Cannot assign to a member of variable 'ref readonly (int Alice, int Bob)' because it is a readonly variable
// arg2.Alice --;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "arg2.Alice").WithArguments("variable", "ref readonly (int Alice, int Bob)").WithLocation(10, 9),
// (12,9): error CS8208: Cannot assign to variable 'ref readonly int' because it is a readonly variable
// (12,9): error CS8408: Cannot assign to variable 'ref readonly int' because it is a readonly variable
// arg1 += 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "arg1").WithArguments("variable", "ref readonly int").WithLocation(12, 9),
// (13,9): error CS8209: Cannot assign to a member of variable 'ref readonly (int Alice, int Bob)' because it is a readonly variable
// (13,9): error CS8409: Cannot assign to a member of variable 'ref readonly (int Alice, int Bob)' because it is a readonly variable
// arg2.Alice -= 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "arg2.Alice").WithArguments("variable", "ref readonly (int Alice, int Bob)").WithLocation(13, 9)
);
......@@ -158,10 +158,10 @@ static void M(in int arg1, in (int Alice, int Bob) arg2)
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,25): error CS8206: Cannot use variable 'ref readonly int' as a ref or out value because it is a readonly variable
// (6,25): error CS8406: Cannot use variable 'ref readonly int' as a ref or out value because it is a readonly variable
// ref var y = ref arg1;
Diagnostic(ErrorCode.ERR_RefReadonlyNotField, "arg1").WithArguments("variable", "ref readonly int").WithLocation(6, 25),
// (7,25): error CS8207: Members of variable 'ref readonly (int Alice, int Bob)' cannot be used as a ref or out value because it is a readonly variable
// (7,25): error CS8407: Members of variable 'ref readonly (int Alice, int Bob)' cannot be used as a ref or out value because it is a readonly variable
// ref int a = ref arg2.Alice;
Diagnostic(ErrorCode.ERR_RefReadonlyNotField2, "arg2.Alice").WithArguments("variable", "ref readonly (int Alice, int Bob)").WithLocation(7, 25)
);
......@@ -230,10 +230,10 @@ class Program
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (10,24): error CS8206: Cannot use variable 'ref readonly int' as a ref or out value because it is a readonly variable
// (10,24): error CS8406: Cannot use variable 'ref readonly int' as a ref or out value because it is a readonly variable
// return ref arg1;
Diagnostic(ErrorCode.ERR_RefReadonlyNotField, "arg1").WithArguments("variable", "ref readonly int").WithLocation(10, 24),
// (14,24): error CS8207: Members of variable 'ref readonly (int Alice, int Bob)' cannot be used as a ref or out value because it is a readonly variable
// (14,24): error CS8407: Members of variable 'ref readonly (int Alice, int Bob)' cannot be used as a ref or out value because it is a readonly variable
// return ref arg2.Alice;
Diagnostic(ErrorCode.ERR_RefReadonlyNotField2, "arg2.Alice").WithArguments("variable", "ref readonly (int Alice, int Bob)").WithLocation(14, 24)
);
......
......@@ -107,22 +107,22 @@ static void Test()
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,9): error CS8208: Cannot assign to method 'Program.M()' because it is a readonly variable
// (6,9): error CS8408: Cannot assign to method 'Program.M()' because it is a readonly variable
// M() = 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(6, 9),
// (7,9): error CS8209: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
// (7,9): error CS8409: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
// M1().Alice = 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(7, 9),
// (9,9): error CS8208: Cannot assign to method 'Program.M()' because it is a readonly variable
// (9,9): error CS8408: Cannot assign to method 'Program.M()' because it is a readonly variable
// M() ++;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(9, 9),
// (10,9): error CS8209: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
// (10,9): error CS8409: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
// M1().Alice --;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(10, 9),
// (12,9): error CS8208: Cannot assign to method 'Program.M()' because it is a readonly variable
// (12,9): error CS8408: Cannot assign to method 'Program.M()' because it is a readonly variable
// M() += 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(12, 9),
// (13,9): error CS8209: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
// (13,9): error CS8409: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
// M1().Alice -= 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(13, 9)
);
......@@ -153,22 +153,22 @@ static void Test()
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,9): error CS8208: Cannot assign to property 'Program.P' because it is a readonly variable
// (6,9): error CS8408: Cannot assign to property 'Program.P' because it is a readonly variable
// P = 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(6, 9),
// (7,9): error CS8209: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
// (7,9): error CS8409: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
// P1.Alice = 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(7, 9),
// (9,9): error CS8208: Cannot assign to property 'Program.P' because it is a readonly variable
// (9,9): error CS8408: Cannot assign to property 'Program.P' because it is a readonly variable
// P ++;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(9, 9),
// (10,9): error CS8209: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
// (10,9): error CS8409: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
// P1.Alice --;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(10, 9),
// (12,9): error CS8208: Cannot assign to property 'Program.P' because it is a readonly variable
// (12,9): error CS8408: Cannot assign to property 'Program.P' because it is a readonly variable
// P += 1;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(12, 9),
// (13,9): error CS8209: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
// (13,9): error CS8409: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
// P1.Alice -= 2;
Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(13, 9)
);
......@@ -197,16 +197,16 @@ static void Test()
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (6,25): error CS8206: Cannot use method 'Program.M()' as a ref or out value because it is a readonly variable
// (6,25): error CS8406: Cannot use method 'Program.M()' as a ref or out value because it is a readonly variable
// ref var y = ref M();
Diagnostic(ErrorCode.ERR_RefReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(6, 25),
// (7,25): error CS0119: 'Program.M1()' is a method, which is not valid in the given context
// ref int a = ref M1.Alice;
Diagnostic(ErrorCode.ERR_BadSKunknown, "M1").WithArguments("Program.M1()", "method").WithLocation(7, 25),
// (8,26): error CS8206: Cannot use property 'Program.P' as a ref or out value because it is a readonly variable
// (8,26): error CS8406: Cannot use property 'Program.P' as a ref or out value because it is a readonly variable
// ref var y1 = ref P;
Diagnostic(ErrorCode.ERR_RefReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(8, 26),
// (9,26): error CS8207: Members of property 'Program.P1' cannot be used as a ref or out value because it is a readonly variable
// (9,26): error CS8407: Members of property 'Program.P1' cannot be used as a ref or out value because it is a readonly variable
// ref int a1 = ref P1.Alice;
Diagnostic(ErrorCode.ERR_RefReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(9, 26)
);
......@@ -323,16 +323,16 @@ class Program
var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyDiagnostics(
// (12,28): error CS8206: Cannot use method 'Program.M()' as a ref or out value because it is a readonly variable
// (12,28): error CS8406: Cannot use method 'Program.M()' as a ref or out value because it is a readonly variable
// return ref M();
Diagnostic(ErrorCode.ERR_RefReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(12, 28),
// (16,28): error CS8207: Members of method 'Program.M1()' cannot be used as a ref or out value because it is a readonly variable
// (16,28): error CS8407: Members of method 'Program.M1()' cannot be used as a ref or out value because it is a readonly variable
// return ref M1().Alice;
Diagnostic(ErrorCode.ERR_RefReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(16, 28),
// (23,28): error CS8206: Cannot use property 'Program.P' as a ref or out value because it is a readonly variable
// (23,28): error CS8406: Cannot use property 'Program.P' as a ref or out value because it is a readonly variable
// return ref P;
Diagnostic(ErrorCode.ERR_RefReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(23, 28),
// (27,28): error CS8207: Members of property 'Program.P1' cannot be used as a ref or out value because it is a readonly variable
// (27,28): error CS8407: Members of property 'Program.P1' cannot be used as a ref or out value because it is a readonly variable
// return ref P1.Alice;
Diagnostic(ErrorCode.ERR_RefReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(27, 28)
);
......
......@@ -3896,7 +3896,7 @@ public ValueTuple(T1 item1, T2 item2)
";
var comp = CreateCompilationWithMscorlib(source, assemblyName: "comp");
comp.VerifyDiagnostics(
// (11,13): error CS8207: Cannot define a class or member that utilizes tuples because the compiler required type 'System.Runtime.CompilerServices.TupleElementNamesAttribute' cannot be found. Are you missing a reference?
// (11,13): error CS8407: Cannot define a class or member that utilizes tuples because the compiler required type 'System.Runtime.CompilerServices.TupleElementNamesAttribute' cannot be found. Are you missing a reference?
// void M2((int a, int b) y)
Diagnostic(ErrorCode.ERR_TupleElementNamesAttributeMissing, "(int a, int b)").WithArguments("System.Runtime.CompilerServices.TupleElementNamesAttribute").WithLocation(11, 13),
// (7,39): error CS8128: Member 'Item1' was not found on type 'ValueTuple<T1, T2>' from assembly 'comp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
......@@ -14242,7 +14242,7 @@ public TestAttribute((int, string) val)
// (6,38): error CS8129: Type of the tuple element cannot be infered from '<null>'.
// var x0 = new {tuple = (null, null)};
Diagnostic(ErrorCode.Unknown, "null").WithArguments("<null>").WithLocation(6, 38),
// (8,31): error CS8207: Cannot implicitly convert tuple expression to 'ValueType'
// (8,31): error CS8407: Cannot implicitly convert tuple expression to 'ValueType'
// System.ValueType x1 = (null, "1");
Diagnostic(ErrorCode.Unknown, @"(null, ""1"")").WithArguments("System.ValueType").WithLocation(8, 31),
// (11,20): error CS1503: Argument 1: cannot convert from '<tuple>' to '(int, string)'
......@@ -14278,25 +14278,25 @@ public TestAttribute((int, string) val)
// (29,20): error CS0655: 'Val' is not a valid named attribute argument because it is not a valid attribute parameter type
// [TestAttribute(Val = ("12", "12"))]
Diagnostic(ErrorCode.ERR_BadNamedAttributeArgumentType, "Val").WithArguments("Val").WithLocation(29, 20),
// (34,14): error CS8207: Cannot implicitly convert tuple expression to 'int'
// (34,14): error CS8407: Cannot implicitly convert tuple expression to 'int'
// V1 = (13, null),
Diagnostic(ErrorCode.Unknown, "(13, null)").WithArguments("int").WithLocation(34, 14),
// (35,14): error CS8207: Cannot implicitly convert tuple expression to 'int'
// (35,14): error CS8407: Cannot implicitly convert tuple expression to 'int'
// V2 = (14, "14"),
Diagnostic(ErrorCode.Unknown, @"(14, ""14"")").WithArguments("int").WithLocation(35, 14),
// (36,14): error CS8207: Cannot implicitly convert tuple expression to 'int'
// (36,14): error CS8407: Cannot implicitly convert tuple expression to 'int'
// V3 = ("15", "15"),
Diagnostic(ErrorCode.Unknown, @"(""15"", ""15"")").WithArguments("int").WithLocation(36, 14),
// (41,28): error CS8129: Type of the tuple element cannot be infered from '<null>'.
// var x = (16, (16 , null));
Diagnostic(ErrorCode.Unknown, "null").WithArguments("<null>").WithLocation(41, 28),
// (44,17): error CS8207: Cannot implicitly convert tuple expression to 'TypedReference'
// (44,17): error CS8407: Cannot implicitly convert tuple expression to 'TypedReference'
// var u = __refvalue((17, null), (int, string));
Diagnostic(ErrorCode.Unknown, "__refvalue((17, null), (int, string))").WithArguments("System.TypedReference").WithLocation(44, 17),
// (45,17): error CS8207: Cannot implicitly convert tuple expression to 'TypedReference'
// (45,17): error CS8407: Cannot implicitly convert tuple expression to 'TypedReference'
// var v = __refvalue((18, "18"), (int, string));
Diagnostic(ErrorCode.Unknown, @"__refvalue((18, ""18""), (int, string))").WithArguments("System.TypedReference").WithLocation(45, 17),
// (46,17): error CS8207: Cannot implicitly convert tuple expression to 'TypedReference'
// (46,17): error CS8407: Cannot implicitly convert tuple expression to 'TypedReference'
// var w = __refvalue(("19", "19"), (int, string));
Diagnostic(ErrorCode.Unknown, @"__refvalue((""19"", ""19""), (int, string))").WithArguments("System.TypedReference").WithLocation(46, 17)
);
......
......@@ -2783,10 +2783,10 @@ static void Main()
";
var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.ReleaseExe);
compilation.VerifyDiagnostics(
// (9,18): error CS8207: It is not legal to use the type 'dynamic' in a pattern.
// (9,18): error CS8407: It is not legal to use the type 'dynamic' in a pattern.
// case dynamic x: // error 1
Diagnostic(ErrorCode.ERR_PatternDynamicType, "dynamic"),
// (12,18): error CS8207: It is not legal to use the type 'dynamic' in a pattern.
// (12,18): error CS8407: It is not legal to use the type 'dynamic' in a pattern.
// if (d is dynamic y) {} // error 2
Diagnostic(ErrorCode.ERR_PatternDynamicType, "dynamic").WithLocation(12, 18)
);
......
......@@ -19524,7 +19524,7 @@ .module ForwarderModule.dll
var compilation = CreateCompilationWithCustomILSource(userCode, forwardingIL, appendDefaultHeader: false);
compilation.VerifyDiagnostics(
// (8,29): error CS8206: Module 'ForwarderModule.dll' in assembly 'Forwarder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'Destination.TestClass' to multiple assemblies: 'Destination1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Destination2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
// (8,29): error CS8406: Module 'ForwarderModule.dll' in assembly 'Forwarder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'Destination.TestClass' to multiple assemblies: 'Destination1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Destination2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
// new Destination.TestClass();
Diagnostic(ErrorCode.ERR_TypeForwardedToMultipleAssemblies, "TestClass").WithArguments("ForwarderModule.dll", "Forwarder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Destination.TestClass", "Destination1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "Destination2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(8, 29),
// (8,29): error CS0234: The type or namespace name 'TestClass' does not exist in the namespace 'Destination' (are you missing an assembly reference?)
......@@ -19587,7 +19587,7 @@ .module ForwarderModule.dll
var compilation = CreateCompilationWithCustomILSource(userCode, forwardingIL, appendDefaultHeader: false);
compilation.VerifyDiagnostics(
// (8,29): error CS8206: Module 'ForwarderModule.dll' in assembly 'Forwarder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'Destination.TestClass' to multiple assemblies: 'Destination1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Destination2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// (8,29): error CS8406: Module 'ForwarderModule.dll' in assembly 'Forwarder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'Destination.TestClass' to multiple assemblies: 'Destination1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Destination2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// new Destination.TestClass();
Diagnostic(ErrorCode.ERR_TypeForwardedToMultipleAssemblies, "TestClass").WithArguments("ForwarderModule.dll", "Forwarder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "Destination.TestClass", "Destination1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "Destination2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(8, 29),
// (8,29): error CS0234: The type or namespace name 'TestClass' does not exist in the namespace 'Destination' (are you missing an assembly reference?)
......@@ -19657,7 +19657,7 @@ .module CModule.dll
var referenceC2 = CompileIL(codeC2, appendDefaultHeader: false);
CreateCompilationWithMscorlib(codeA, references: new MetadataReference[] { referenceB, referenceC2 }, assemblyName: "A").VerifyDiagnostics(
// (10,13): error CS8206: Module 'CModule.dll' in assembly 'C, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'C.ClassC' to multiple assemblies: 'D1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'D2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// (10,13): error CS8406: Module 'CModule.dll' in assembly 'C, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'C.ClassC' to multiple assemblies: 'D1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'D2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// ClassB.MethodB(null);
Diagnostic(ErrorCode.ERR_TypeForwardedToMultipleAssemblies, "ClassB.MethodB").WithArguments("CModule.dll", "C, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "C.ClassC", "D1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "D2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"));
}
......@@ -19759,7 +19759,7 @@ .module ForwarderModule.dll
var ilModule = GetILModuleReference(ilSource, appendDefaultHeader: false);
CreateCompilationWithMscorlib(string.Empty, references: new MetadataReference[] { ilModule }, assemblyName: "Forwarder").VerifyDiagnostics(
// error CS8206: Module 'ForwarderModule.dll' in assembly 'Forwarder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'Testspace.TestType' to multiple assemblies: 'D1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'D2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// error CS8406: Module 'ForwarderModule.dll' in assembly 'Forwarder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'Testspace.TestType' to multiple assemblies: 'D1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'D2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
Diagnostic(ErrorCode.ERR_TypeForwardedToMultipleAssemblies).WithArguments("ForwarderModule.dll", "Forwarder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "Testspace.TestType", "D1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "D2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(1, 1));
}
......@@ -19836,7 +19836,7 @@ public static void Main()
assemblyName: "UserAssembly");
userCompilation.VerifyDiagnostics(
// (8,37): error CS8206: Module 'ForwarderModule.dll' in assembly 'Forwarder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'Testspace.TestType' to multiple assemblies: 'D1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'D2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// (8,37): error CS8406: Module 'ForwarderModule.dll' in assembly 'Forwarder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'Testspace.TestType' to multiple assemblies: 'D1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'D2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// var obj = new Testspace.TestType();
Diagnostic(ErrorCode.ERR_TypeForwardedToMultipleAssemblies, "TestType").WithArguments("ForwarderModule.dll", "Forwarder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "Testspace.TestType", "D1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "D2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(8, 37),
// (8,37): error CS0234: The type or namespace name 'TestType' does not exist in the namespace 'Testspace' (are you missing an assembly reference?)
......@@ -19901,7 +19901,7 @@ public static void Main()
assemblyName: "UserAssembly");
userCompilation.VerifyDiagnostics(
// (8,37): error CS8206: Module 'module12L.dll' in assembly 'Forwarder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'Testspace.TestType' to multiple assemblies: 'D3, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'D4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// (8,37): error CS8406: Module 'module12L.dll' in assembly 'Forwarder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'Testspace.TestType' to multiple assemblies: 'D3, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'D4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// var obj = new Testspace.TestType();
Diagnostic(ErrorCode.ERR_TypeForwardedToMultipleAssemblies, "TestType").WithArguments("module12L.dll", "Forwarder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "Testspace.TestType", "D3, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "D4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"),
// (8,37): error CS0234: The type or namespace name 'TestType' does not exist in the namespace 'Testspace' (are you missing an assembly reference?)
......@@ -19981,7 +19981,7 @@ public void MethodA(ClassC obj)
}";
CreateCompilationWithMscorlib(codeA, references: new MetadataReference[] { referenceB, referenceC2, referenceD, referenceE }, assemblyName: "A").VerifyDiagnostics(
// (11,13): error CS8206: Module 'C.dll' in assembly 'C, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'C.ClassC' to multiple assemblies: 'D, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'E, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// (11,13): error CS8406: Module 'C.dll' in assembly 'C, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is forwarding the type 'C.ClassC' to multiple assemblies: 'D, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' and 'E, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// ClassB.MethodB(obj);
Diagnostic(ErrorCode.ERR_TypeForwardedToMultipleAssemblies, "ClassB.MethodB").WithArguments("C.dll", "C, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "C.ClassC", "D, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "E, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(11, 13));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册