提交 7fc985fa 编写于 作者: J Julien 提交者: GitHub

Align tuple error messages to use 'element' terminology (#14080)

上级 82dd290d
......@@ -519,17 +519,17 @@ private static bool CheckTupleMemberName(string name, int index, CSharpSyntaxNod
int reserved = TupleTypeSymbol.IsElementNameReserved(name);
if (reserved == 0)
{
Error(diagnostics, ErrorCode.ERR_TupleReservedMemberNameAnyPosition, syntax, name);
Error(diagnostics, ErrorCode.ERR_TupleReservedElementNameAnyPosition, syntax, name);
return false;
}
else if (reserved > 0 && reserved != index + 1)
{
Error(diagnostics, ErrorCode.ERR_TupleReservedMemberName, syntax, name, reserved);
Error(diagnostics, ErrorCode.ERR_TupleReservedElementName, syntax, name, reserved);
return false;
}
else if (!uniqueFieldNames.Add(name))
{
Error(diagnostics, ErrorCode.ERR_TupleDuplicateMemberName, syntax);
Error(diagnostics, ErrorCode.ERR_TupleDuplicateElementName, syntax);
return false;
}
return true;
......
......@@ -4857,14 +4857,14 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="ERR_PeWritingFailure" xml:space="preserve">
<value>An error occurred while writing the output file: {0}.</value>
</data>
<data name="ERR_TupleDuplicateMemberName" xml:space="preserve">
<value>Tuple member names must be unique.</value>
<data name="ERR_TupleDuplicateElementName" xml:space="preserve">
<value>Tuple element names must be unique.</value>
</data>
<data name="ERR_TupleReservedMemberName" xml:space="preserve">
<value>Tuple member name '{0}' is only allowed at position {1}.</value>
<data name="ERR_TupleReservedElementName" xml:space="preserve">
<value>Tuple element name '{0}' is only allowed at position {1}.</value>
</data>
<data name="ERR_TupleReservedMemberNameAnyPosition" xml:space="preserve">
<value>Tuple member name '{0}' is disallowed at any position.</value>
<data name="ERR_TupleReservedElementNameAnyPosition" xml:space="preserve">
<value>Tuple element name '{0}' is disallowed at any position.</value>
</data>
<data name="ERR_PredefinedTypeMemberNotFoundInAssembly" xml:space="preserve">
<value>Member '{0}' was not found on type '{1}' from assembly '{2}'.</value>
......
......@@ -1366,9 +1366,9 @@ internal enum ErrorCode
#region tuple diagnostics introduced in C# 7
WRN_TupleLiteralNameMismatch = 8123,
ERR_TupleTooFewElements = 8124,
ERR_TupleReservedMemberName = 8125,
ERR_TupleReservedMemberNameAnyPosition = 8126,
ERR_TupleDuplicateMemberName = 8127,
ERR_TupleReservedElementName = 8125,
ERR_TupleReservedElementNameAnyPosition = 8126,
ERR_TupleDuplicateElementName = 8127,
ERR_PredefinedTypeMemberNotFoundInAssembly = 8128,
ERR_MissingDeconstruct = 8129,
ERR_TypeInferenceFailedForImplicitlyTypedDeconstructionVariable = 8130,
......
......@@ -2902,13 +2902,13 @@ static void Main()
comp.VerifyDiagnostics(
// (6,24): error CS8127: Tuple member names must be unique.
// (int a, string a) x = (b: 1, b: "hello", b: 2);
Diagnostic(ErrorCode.ERR_TupleDuplicateMemberName, "a").WithLocation(6, 24),
Diagnostic(ErrorCode.ERR_TupleDuplicateElementName, "a").WithLocation(6, 24),
// (6,38): error CS8127: Tuple member names must be unique.
// (int a, string a) x = (b: 1, b: "hello", b: 2);
Diagnostic(ErrorCode.ERR_TupleDuplicateMemberName, "b").WithLocation(6, 38),
Diagnostic(ErrorCode.ERR_TupleDuplicateElementName, "b").WithLocation(6, 38),
// (6,50): error CS8127: Tuple member names must be unique.
// (int a, string a) x = (b: 1, b: "hello", b: 2);
Diagnostic(ErrorCode.ERR_TupleDuplicateMemberName, "b").WithLocation(6, 50)
Diagnostic(ErrorCode.ERR_TupleDuplicateElementName, "b").WithLocation(6, 50)
);
}
......@@ -2930,16 +2930,16 @@ static void Main()
comp.VerifyDiagnostics(
// (6,28): error CS8125: Tuple member name 'Item1' is only allowed at position 1.
// (int Item1, string Item1) x = (Item1: 1, Item1: "hello");
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item1").WithArguments("Item1", "1").WithLocation(6, 28),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item1").WithArguments("Item1", "1").WithLocation(6, 28),
// (6,50): error CS8125: Tuple member name 'Item1' is only allowed at position 1.
// (int Item1, string Item1) x = (Item1: 1, Item1: "hello");
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item1").WithArguments("Item1", "1").WithLocation(6, 50),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item1").WithArguments("Item1", "1").WithLocation(6, 50),
// (7,14): error CS8125: Tuple member name 'Item2' is only allowed at position 2.
// (int Item2, string Item2) y = (Item2: 1, Item2: "hello");
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item2").WithArguments("Item2", "2").WithLocation(7, 14),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item2").WithArguments("Item2", "2").WithLocation(7, 14),
// (7,40): error CS8125: Tuple member name 'Item2' is only allowed at position 2.
// (int Item2, string Item2) y = (Item2: 1, Item2: "hello");
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item2").WithArguments("Item2", "2").WithLocation(7, 40)
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item2").WithArguments("Item2", "2").WithLocation(7, 40)
);
}
......@@ -2960,13 +2960,13 @@ static void Main()
comp.VerifyDiagnostics(
// (6,37): error CS8125: Tuple member name 'Item10' is only allowed at position 10.
// (int Item1, int Item01, int Item10) x = (Item01: 1, Item1: 2, Item10: 3);
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item10").WithArguments("Item10", "10").WithLocation(6, 37),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item10").WithArguments("Item10", "10").WithLocation(6, 37),
// (6,61): error CS8125: Tuple member name 'Item1' is only allowed at position 1.
// (int Item1, int Item01, int Item10) x = (Item01: 1, Item1: 2, Item10: 3);
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item1").WithArguments("Item1", "1").WithLocation(6, 61),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item1").WithArguments("Item1", "1").WithLocation(6, 61),
// (6,71): error CS8125: Tuple member name 'Item10' is only allowed at position 10.
// (int Item1, int Item01, int Item10) x = (Item01: 1, Item1: 2, Item10: 3);
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item10").WithArguments("Item10", "10").WithLocation(6, 71)
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item10").WithArguments("Item10", "10").WithLocation(6, 71)
);
}
......@@ -3007,10 +3007,10 @@ static void Main()
comp.VerifyDiagnostics(
// (6,24): error CS8127: Tuple member names must be unique.
// (int a, string a) x = (b: 1, c: "hello", b: 2);
Diagnostic(ErrorCode.ERR_TupleDuplicateMemberName, "a").WithLocation(6, 24),
Diagnostic(ErrorCode.ERR_TupleDuplicateElementName, "a").WithLocation(6, 24),
// (6,50): error CS8127: Tuple member names must be unique.
// (int a, string a) x = (b: 1, c: "hello", b: 2);
Diagnostic(ErrorCode.ERR_TupleDuplicateMemberName, "b").WithLocation(6, 50)
Diagnostic(ErrorCode.ERR_TupleDuplicateElementName, "b").WithLocation(6, 50)
);
}
......@@ -3031,22 +3031,22 @@ static void Main()
comp.VerifyDiagnostics(
// (6,28): error CS8125: Tuple member name 'Item3' is only allowed at position 3.
// (int Item1, string Item3, string Item2, int Item4, int Item5, int Item6, int Item7, string Rest) x = (Item2: "bad", Item4: "bad", Item3: 3, Item4: 4, Item5: 5, Item6: 6, Item7: 7, Rest: "bad");
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item3").WithArguments("Item3", "3").WithLocation(6, 28),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item3").WithArguments("Item3", "3").WithLocation(6, 28),
// (6,42): error CS8125: Tuple member name 'Item2' is only allowed at position 2.
// (int Item1, string Item3, string Item2, int Item4, int Item5, int Item6, int Item7, string Rest) x = (Item2: "bad", Item4: "bad", Item3: 3, Item4: 4, Item5: 5, Item6: 6, Item7: 7, Rest: "bad");
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item2").WithArguments("Item2", "2").WithLocation(6, 42),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item2").WithArguments("Item2", "2").WithLocation(6, 42),
// (6,100): error CS8126: Tuple member name 'Rest' is disallowed at any position.
// (int Item1, string Item3, string Item2, int Item4, int Item5, int Item6, int Item7, string Rest) x = (Item2: "bad", Item4: "bad", Item3: 3, Item4: 4, Item5: 5, Item6: 6, Item7: 7, Rest: "bad");
Diagnostic(ErrorCode.ERR_TupleReservedMemberNameAnyPosition, "Rest").WithArguments("Rest").WithLocation(6, 100),
Diagnostic(ErrorCode.ERR_TupleReservedElementNameAnyPosition, "Rest").WithArguments("Rest").WithLocation(6, 100),
// (6,111): error CS8125: Tuple member name 'Item2' is only allowed at position 2.
// (int Item1, string Item3, string Item2, int Item4, int Item5, int Item6, int Item7, string Rest) x = (Item2: "bad", Item4: "bad", Item3: 3, Item4: 4, Item5: 5, Item6: 6, Item7: 7, Rest: "bad");
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item2").WithArguments("Item2", "2").WithLocation(6, 111),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item2").WithArguments("Item2", "2").WithLocation(6, 111),
// (6,125): error CS8125: Tuple member name 'Item4' is only allowed at position 4.
// (int Item1, string Item3, string Item2, int Item4, int Item5, int Item6, int Item7, string Rest) x = (Item2: "bad", Item4: "bad", Item3: 3, Item4: 4, Item5: 5, Item6: 6, Item7: 7, Rest: "bad");
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item4").WithArguments("Item4", "4").WithLocation(6, 125),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item4").WithArguments("Item4", "4").WithLocation(6, 125),
// (6,189): error CS8126: Tuple member name 'Rest' is disallowed at any position.
// (int Item1, string Item3, string Item2, int Item4, int Item5, int Item6, int Item7, string Rest) x = (Item2: "bad", Item4: "bad", Item3: 3, Item4: 4, Item5: 5, Item6: 6, Item7: 7, Rest: "bad");
Diagnostic(ErrorCode.ERR_TupleReservedMemberNameAnyPosition, "Rest").WithArguments("Rest").WithLocation(6, 189)
Diagnostic(ErrorCode.ERR_TupleReservedElementNameAnyPosition, "Rest").WithArguments("Rest").WithLocation(6, 189)
);
}
......@@ -3067,22 +3067,22 @@ static void Main()
comp.VerifyDiagnostics(
// (6,18): error CS8126: Tuple member name 'CompareTo' is disallowed at any position.
// var x = (CompareTo: 2, Create: 3, Deconstruct: 4, Equals: 5, GetHashCode: 6, Rest: 8, ToString: 10);
Diagnostic(ErrorCode.ERR_TupleReservedMemberNameAnyPosition, "CompareTo").WithArguments("CompareTo").WithLocation(6, 18),
Diagnostic(ErrorCode.ERR_TupleReservedElementNameAnyPosition, "CompareTo").WithArguments("CompareTo").WithLocation(6, 18),
// (6,43): error CS8126: Tuple member name 'Deconstruct' is disallowed at any position.
// var x = (CompareTo: 2, Create: 3, Deconstruct: 4, Equals: 5, GetHashCode: 6, Rest: 8, ToString: 10);
Diagnostic(ErrorCode.ERR_TupleReservedMemberNameAnyPosition, "Deconstruct").WithArguments("Deconstruct").WithLocation(6, 43),
Diagnostic(ErrorCode.ERR_TupleReservedElementNameAnyPosition, "Deconstruct").WithArguments("Deconstruct").WithLocation(6, 43),
// (6,59): error CS8126: Tuple member name 'Equals' is disallowed at any position.
// var x = (CompareTo: 2, Create: 3, Deconstruct: 4, Equals: 5, GetHashCode: 6, Rest: 8, ToString: 10);
Diagnostic(ErrorCode.ERR_TupleReservedMemberNameAnyPosition, "Equals").WithArguments("Equals").WithLocation(6, 59),
Diagnostic(ErrorCode.ERR_TupleReservedElementNameAnyPosition, "Equals").WithArguments("Equals").WithLocation(6, 59),
// (6,70): error CS8126: Tuple member name 'GetHashCode' is disallowed at any position.
// var x = (CompareTo: 2, Create: 3, Deconstruct: 4, Equals: 5, GetHashCode: 6, Rest: 8, ToString: 10);
Diagnostic(ErrorCode.ERR_TupleReservedMemberNameAnyPosition, "GetHashCode").WithArguments("GetHashCode").WithLocation(6, 70),
Diagnostic(ErrorCode.ERR_TupleReservedElementNameAnyPosition, "GetHashCode").WithArguments("GetHashCode").WithLocation(6, 70),
// (6,86): error CS8126: Tuple member name 'Rest' is disallowed at any position.
// var x = (CompareTo: 2, Create: 3, Deconstruct: 4, Equals: 5, GetHashCode: 6, Rest: 8, ToString: 10);
Diagnostic(ErrorCode.ERR_TupleReservedMemberNameAnyPosition, "Rest").WithArguments("Rest").WithLocation(6, 86),
Diagnostic(ErrorCode.ERR_TupleReservedElementNameAnyPosition, "Rest").WithArguments("Rest").WithLocation(6, 86),
// (6,95): error CS8126: Tuple member name 'ToString' is disallowed at any position.
// var x = (CompareTo: 2, Create: 3, Deconstruct: 4, Equals: 5, GetHashCode: 6, Rest: 8, ToString: 10);
Diagnostic(ErrorCode.ERR_TupleReservedMemberNameAnyPosition, "ToString").WithArguments("ToString").WithLocation(6, 95)
Diagnostic(ErrorCode.ERR_TupleReservedElementNameAnyPosition, "ToString").WithArguments("ToString").WithLocation(6, 95)
);
}
......@@ -9562,31 +9562,31 @@ static void Main()
comp.VerifyDiagnostics(
// (9,17): error CS8125: Tuple member name 'Item9' is only allowed at position 9.
// static (int Item9, int Item1, int Item2, int Item3, int Item4, int Item5, int Item6, int Item7, int Item8) M7()
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item9").WithArguments("Item9", "9").WithLocation(9, 17),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item9").WithArguments("Item9", "9").WithLocation(9, 17),
// (9,28): error CS8125: Tuple member name 'Item1' is only allowed at position 1.
// static (int Item9, int Item1, int Item2, int Item3, int Item4, int Item5, int Item6, int Item7, int Item8) M7()
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item1").WithArguments("Item1", "1").WithLocation(9, 28),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item1").WithArguments("Item1", "1").WithLocation(9, 28),
// (9,39): error CS8125: Tuple member name 'Item2' is only allowed at position 2.
// static (int Item9, int Item1, int Item2, int Item3, int Item4, int Item5, int Item6, int Item7, int Item8) M7()
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item2").WithArguments("Item2", "2").WithLocation(9, 39),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item2").WithArguments("Item2", "2").WithLocation(9, 39),
// (9,50): error CS8125: Tuple member name 'Item3' is only allowed at position 3.
// static (int Item9, int Item1, int Item2, int Item3, int Item4, int Item5, int Item6, int Item7, int Item8) M7()
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item3").WithArguments("Item3", "3").WithLocation(9, 50),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item3").WithArguments("Item3", "3").WithLocation(9, 50),
// (9,61): error CS8125: Tuple member name 'Item4' is only allowed at position 4.
// static (int Item9, int Item1, int Item2, int Item3, int Item4, int Item5, int Item6, int Item7, int Item8) M7()
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item4").WithArguments("Item4", "4").WithLocation(9, 61),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item4").WithArguments("Item4", "4").WithLocation(9, 61),
// (9,72): error CS8125: Tuple member name 'Item5' is only allowed at position 5.
// static (int Item9, int Item1, int Item2, int Item3, int Item4, int Item5, int Item6, int Item7, int Item8) M7()
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item5").WithArguments("Item5", "5").WithLocation(9, 72),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item5").WithArguments("Item5", "5").WithLocation(9, 72),
// (9,83): error CS8125: Tuple member name 'Item6' is only allowed at position 6.
// static (int Item9, int Item1, int Item2, int Item3, int Item4, int Item5, int Item6, int Item7, int Item8) M7()
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item6").WithArguments("Item6", "6").WithLocation(9, 83),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item6").WithArguments("Item6", "6").WithLocation(9, 83),
// (9,94): error CS8125: Tuple member name 'Item7' is only allowed at position 7.
// static (int Item9, int Item1, int Item2, int Item3, int Item4, int Item5, int Item6, int Item7, int Item8) M7()
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item7").WithArguments("Item7", "7").WithLocation(9, 94),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item7").WithArguments("Item7", "7").WithLocation(9, 94),
// (9,105): error CS8125: Tuple member name 'Item8' is only allowed at position 8.
// static (int Item9, int Item1, int Item2, int Item3, int Item4, int Item5, int Item6, int Item7, int Item8) M7()
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item8").WithArguments("Item8", "8").WithLocation(9, 105)
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item8").WithArguments("Item8", "8").WithLocation(9, 105)
);
var c = comp.GetTypeByMetadataName("C");
......@@ -9666,7 +9666,7 @@ static void Main()
comp.VerifyDiagnostics(
// (9,73): error CS8125: Tuple member name 'Item1' is only allowed at position 1.
// static (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int Item1) M8()
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item1").WithArguments("Item1", "1").WithLocation(9, 73)
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item1").WithArguments("Item1", "1").WithLocation(9, 73)
);
var c = comp.GetTypeByMetadataName("C");
......@@ -10204,7 +10204,7 @@ static void Test03()
Diagnostic(ErrorCode.WRN_DeprecatedSymbol, "(int a, int b)").WithArguments("(int a, int b)").WithLocation(23, 12),
// (35,73): error CS8125: Tuple member name 'Item2' is only allowed at position 2.
// static (int a, int b, int c, int d, int e, int f, int g, int h, int Item2) M103()
Diagnostic(ErrorCode.ERR_TupleReservedMemberName, "Item2").WithArguments("Item2", "2").WithLocation(35, 73),
Diagnostic(ErrorCode.ERR_TupleReservedElementName, "Item2").WithArguments("Item2", "2").WithLocation(35, 73),
// (35,12): warning CS0612: 'ValueTuple<T1, T2>' is obsolete
// static (int a, int b, int c, int d, int e, int f, int g, int h, int Item2) M103()
Diagnostic(ErrorCode.WRN_DeprecatedSymbol, "(int a, int b, int c, int d, int e, int f, int g, int h, int Item2)").WithArguments("System.ValueTuple<T1, T2>").WithLocation(35, 12),
......
......@@ -450,15 +450,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Private Shared Function CheckTupleMemberName(name As String, index As Integer, syntax As VisualBasicSyntaxNode, diagnostics As DiagnosticBag, uniqueFieldNames As HashSet(Of String)) As Boolean
Dim reserved As Integer = TupleTypeSymbol.IsElementNameReserved(name)
If reserved = 0 Then
Binder.ReportDiagnostic(diagnostics, syntax, ERRID.ERR_TupleReservedMemberNameAnyPosition, name)
Binder.ReportDiagnostic(diagnostics, syntax, ERRID.ERR_TupleReservedElementNameAnyPosition, name)
Return False
ElseIf reserved > 0 AndAlso reserved <> index + 1 Then
Binder.ReportDiagnostic(diagnostics, syntax, ERRID.ERR_TupleReservedMemberName, name, reserved)
Binder.ReportDiagnostic(diagnostics, syntax, ERRID.ERR_TupleReservedElementName, name, reserved)
Return False
ElseIf (Not uniqueFieldNames.Add(name)) Then
Binder.ReportDiagnostic(diagnostics, syntax, ERRID.ERR_TupleDuplicateMemberName)
Binder.ReportDiagnostic(diagnostics, syntax, ERRID.ERR_TupleDuplicateElementName)
Return False
End If
......
......@@ -1689,9 +1689,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
ERR_DocFileGen = 37258
ERR_TupleTooFewElements = 37259
ERR_TupleReservedMemberNameAnyPosition = 37260
ERR_TupleReservedMemberName = 37261
ERR_TupleDuplicateMemberName = 37262
ERR_TupleReservedElementNameAnyPosition = 37260
ERR_TupleReservedElementName = 37261
ERR_TupleDuplicateElementName = 37262
ERR_RefReturningCallInExpressionTree = 37263
......
......@@ -5379,14 +5379,14 @@
<data name="ERR_SourceLinkRequiresPortablePdb" xml:space="preserve">
<value>/sourcelink switch is only supported when emitting Portable PDB (/debug:portable or /debug:embedded must be specified).</value>
</data>
<data name="ERR_TupleDuplicateMemberName" xml:space="preserve">
<value>Tuple member names must be unique.</value>
<data name="ERR_TupleDuplicateElementName" xml:space="preserve">
<value>Tuple element names must be unique.</value>
</data>
<data name="ERR_TupleReservedMemberName" xml:space="preserve">
<value>Tuple member name '{0}' is only allowed at position {1}.</value>
<data name="ERR_TupleReservedElementName" xml:space="preserve">
<value>Tuple element name '{0}' is only allowed at position {1}.</value>
</data>
<data name="ERR_TupleReservedMemberNameAnyPosition" xml:space="preserve">
<value>Tuple member name '{0}' is disallowed at any position.</value>
<data name="ERR_TupleReservedElementNameAnyPosition" xml:space="preserve">
<value>Tuple element name '{0}' is disallowed at any position.</value>
</data>
<data name="ERR_TupleTooFewElements" xml:space="preserve">
<value>Tuple must contain at least two elements.</value>
......
......@@ -3891,13 +3891,13 @@ End Module
comp.AssertTheseDiagnostics(
<errors>
BC37262: Tuple member names must be unique.
BC37262: Tuple element names must be unique.
Dim x As (a As Integer, a As String) = (b:=1, b:="hello", b:=2)
~
BC37262: Tuple member names must be unique.
BC37262: Tuple element names must be unique.
Dim x As (a As Integer, a As String) = (b:=1, b:="hello", b:=2)
~
BC37262: Tuple member names must be unique.
BC37262: Tuple element names must be unique.
Dim x As (a As Integer, a As String) = (b:=1, b:="hello", b:=2)
~
</errors>)
......@@ -3923,16 +3923,16 @@ End Module
comp.AssertTheseDiagnostics(
<errors>
BC37261: Tuple member name 'Item1' is only allowed at position 1.
BC37261: Tuple element name 'Item1' is only allowed at position 1.
Dim x As (Item1 As Integer, Item1 As String) = (Item1:=1, Item1:="hello")
~~~~~
BC37261: Tuple member name 'Item1' is only allowed at position 1.
BC37261: Tuple element name 'Item1' is only allowed at position 1.
Dim x As (Item1 As Integer, Item1 As String) = (Item1:=1, Item1:="hello")
~~~~~
BC37261: Tuple member name 'Item2' is only allowed at position 2.
BC37261: Tuple element name 'Item2' is only allowed at position 2.
Dim y As (Item2 As Integer, Item2 As String) = (Item2:=1, Item2:="hello")
~~~~~
BC37261: Tuple member name 'Item2' is only allowed at position 2.
BC37261: Tuple element name 'Item2' is only allowed at position 2.
Dim y As (Item2 As Integer, Item2 As String) = (Item2:=1, Item2:="hello")
~~~~~
</errors>)
......@@ -3957,13 +3957,13 @@ End Module
comp.AssertTheseDiagnostics(
<errors>
BC37261: Tuple member name 'Item10' is only allowed at position 10.
BC37261: Tuple element name 'Item10' is only allowed at position 10.
Dim x As (Item1 As Integer, Item01 As Integer, Item10 As Integer) = (Item01:=1, Item1:=2, Item10:=3)
~~~~~~
BC37261: Tuple member name 'Item1' is only allowed at position 1.
BC37261: Tuple element name 'Item1' is only allowed at position 1.
Dim x As (Item1 As Integer, Item01 As Integer, Item10 As Integer) = (Item01:=1, Item1:=2, Item10:=3)
~~~~~
BC37261: Tuple member name 'Item10' is only allowed at position 10.
BC37261: Tuple element name 'Item10' is only allowed at position 10.
Dim x As (Item1 As Integer, Item01 As Integer, Item10 As Integer) = (Item01:=1, Item1:=2, Item10:=3)
~~~~~~
</errors>)
......@@ -4011,10 +4011,10 @@ End Module
comp.AssertTheseDiagnostics(
<errors>
BC37262: Tuple member names must be unique.
BC37262: Tuple element names must be unique.
Dim x As (a As Integer, a As String) = (b:=1, c:="hello", b:=2)
~
BC37262: Tuple member names must be unique.
BC37262: Tuple element names must be unique.
Dim x As (a As Integer, a As String) = (b:=1, c:="hello", b:=2)
~
</errors>)
......@@ -4040,22 +4040,22 @@ End Module
comp.AssertTheseDiagnostics(
<errors>
BC37261: Tuple member name 'Item3' is only allowed at position 3.
BC37261: Tuple element name 'Item3' is only allowed at position 3.
Dim x As (Item1 As Integer, Item3 As String, Item2 As Integer, Item4 As Integer, Item5 As Integer, Item6 As Integer, Item7 As Integer, Rest As Integer) =
~~~~~
BC37261: Tuple member name 'Item2' is only allowed at position 2.
BC37261: Tuple element name 'Item2' is only allowed at position 2.
Dim x As (Item1 As Integer, Item3 As String, Item2 As Integer, Item4 As Integer, Item5 As Integer, Item6 As Integer, Item7 As Integer, Rest As Integer) =
~~~~~
BC37260: Tuple member name 'Rest' is disallowed at any position.
BC37260: Tuple element name 'Rest' is disallowed at any position.
Dim x As (Item1 As Integer, Item3 As String, Item2 As Integer, Item4 As Integer, Item5 As Integer, Item6 As Integer, Item7 As Integer, Rest As Integer) =
~~~~
BC37261: Tuple member name 'Item2' is only allowed at position 2.
BC37261: Tuple element name 'Item2' is only allowed at position 2.
(Item2:="bad", Item4:="bad", Item3:=3, Item4:=4, Item5:=5, Item6:=6, Item7:=7, Rest:="bad")
~~~~~
BC37261: Tuple member name 'Item4' is only allowed at position 4.
BC37261: Tuple element name 'Item4' is only allowed at position 4.
(Item2:="bad", Item4:="bad", Item3:=3, Item4:=4, Item5:=5, Item6:=6, Item7:=7, Rest:="bad")
~~~~~
BC37260: Tuple member name 'Rest' is disallowed at any position.
BC37260: Tuple element name 'Rest' is disallowed at any position.
(Item2:="bad", Item4:="bad", Item3:=3, Item4:=4, Item5:=5, Item6:=6, Item7:=7, Rest:="bad")
~~~~
</errors>)
......@@ -4080,22 +4080,22 @@ End Module
comp.AssertTheseDiagnostics(
<errors>
BC37260: Tuple member name 'CompareTo' is disallowed at any position.
BC37260: Tuple element name 'CompareTo' is disallowed at any position.
Dim x = (CompareTo:=2, Create:=3, Deconstruct:=4, Equals:=5, GetHashCode:=6, Rest:=8, ToString:=10)
~~~~~~~~~
BC37260: Tuple member name 'Deconstruct' is disallowed at any position.
BC37260: Tuple element name 'Deconstruct' is disallowed at any position.
Dim x = (CompareTo:=2, Create:=3, Deconstruct:=4, Equals:=5, GetHashCode:=6, Rest:=8, ToString:=10)
~~~~~~~~~~~
BC37260: Tuple member name 'Equals' is disallowed at any position.
BC37260: Tuple element name 'Equals' is disallowed at any position.
Dim x = (CompareTo:=2, Create:=3, Deconstruct:=4, Equals:=5, GetHashCode:=6, Rest:=8, ToString:=10)
~~~~~~
BC37260: Tuple member name 'GetHashCode' is disallowed at any position.
BC37260: Tuple element name 'GetHashCode' is disallowed at any position.
Dim x = (CompareTo:=2, Create:=3, Deconstruct:=4, Equals:=5, GetHashCode:=6, Rest:=8, ToString:=10)
~~~~~~~~~~~
BC37260: Tuple member name 'Rest' is disallowed at any position.
BC37260: Tuple element name 'Rest' is disallowed at any position.
Dim x = (CompareTo:=2, Create:=3, Deconstruct:=4, Equals:=5, GetHashCode:=6, Rest:=8, ToString:=10)
~~~~
BC37260: Tuple member name 'ToString' is disallowed at any position.
BC37260: Tuple element name 'ToString' is disallowed at any position.
Dim x = (CompareTo:=2, Create:=3, Deconstruct:=4, Equals:=5, GetHashCode:=6, Rest:=8, ToString:=10)
~~~~~~~~
</errors>)
......@@ -6502,7 +6502,7 @@ End Module
comp.AssertTheseDiagnostics(
<errors>
BC37262: Tuple member names must be unique.
BC37262: Tuple element names must be unique.
Dim x1 = (A:=10, a:=20)
~
BC31429: 'A' is ambiguous because multiple kinds of members with this name exist in structure '(A As Integer, a As Integer)'.
......@@ -6511,7 +6511,7 @@ BC31429: 'A' is ambiguous because multiple kinds of members with this name exist
BC31429: 'A' is ambiguous because multiple kinds of members with this name exist in structure '(A As Integer, a As Integer)'.
System.Console.Write(x1.A)
~~~~
BC37262: Tuple member names must be unique.
BC37262: Tuple element names must be unique.
Dim x2 as (A as Integer, a As Integer) = (10, 20)
~
BC31429: 'A' is ambiguous because multiple kinds of members with this name exist in structure '(A As Integer, a As Integer)'.
......@@ -6520,19 +6520,19 @@ BC31429: 'A' is ambiguous because multiple kinds of members with this name exist
BC31429: 'A' is ambiguous because multiple kinds of members with this name exist in structure '(A As Integer, a As Integer)'.
System.Console.Write(x1.A)
~~~~
BC37261: Tuple member name 'item1' is only allowed at position 1.
BC37261: Tuple element name 'item1' is only allowed at position 1.
Dim x3 = (I1:=10, item1:=20)
~~~~~
BC37261: Tuple member name 'item1' is only allowed at position 1.
BC37261: Tuple element name 'item1' is only allowed at position 1.
Dim x4 = (Item1:=10, item1:=20)
~~~~~
BC37261: Tuple member name 'item1' is only allowed at position 1.
BC37261: Tuple element name 'item1' is only allowed at position 1.
Dim x5 = (item1:=10, item1:=20)
~~~~~
BC37260: Tuple member name 'tostring' is disallowed at any position.
BC37260: Tuple element name 'tostring' is disallowed at any position.
Dim x6 = (tostring:=10, item1:=20)
~~~~~~~~
BC37261: Tuple member name 'item1' is only allowed at position 1.
BC37261: Tuple element name 'item1' is only allowed at position 1.
Dim x6 = (tostring:=10, item1:=20)
~~~~~
</errors>)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册