Skip to content

Commit

Permalink
Clarify diagnostic for dropped tuple names (#18454)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv authored Apr 6, 2017
1 parent 3c43a68 commit 4af3f92
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/Compilers/CSharp/Portable/CSharpResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Compilers/CSharp/Portable/CSharpResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -4928,10 +4928,10 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<value>The type must be 'var'.</value>
</data>
<data name="WRN_TupleLiteralNameMismatch" xml:space="preserve">
<value>The tuple element name '{0}' is ignored because a different name is specified by the target type '{1}'.</value>
<value>The tuple element name '{0}' is ignored because a different name or no name is specified by the target type '{1}'.</value>
</data>
<data name="WRN_TupleLiteralNameMismatch_Title" xml:space="preserve">
<value>The tuple element name is ignored because a different name is specified by the assignment target.</value>
<value>The tuple element name is ignored because a different name or no name is specified by the assignment target.</value>
</data>
<data name="ERR_PredefinedValueTupleTypeMustBeStruct" xml:space="preserve">
<value>Predefined type '{0}' must be a struct.</value>
Expand Down
4 changes: 2 additions & 2 deletions src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17236,10 +17236,10 @@ public void M()
";
var comp = CreateCompilationWithMscorlib(source, references: s_valueTupleRefs);
comp.VerifyDiagnostics(
// (6,31): warning CS8123: The tuple element name 'b' is ignored because a different name is specified by the target type '(int a, int)'.
// (6,31): warning CS8123: The tuple element name 'b' is ignored because a different name or no name is specified by the target type '(int a, int)'.
// (int a, int) x1 = (1, b: 2);
Diagnostic(ErrorCode.WRN_TupleLiteralNameMismatch, "b: 2").WithArguments("b", "(int a, int)").WithLocation(6, 31),
// (7,34): warning CS8123: The tuple element name 'b' is ignored because a different name is specified by the target type '(int a, string)'.
// (7,34): warning CS8123: The tuple element name 'b' is ignored because a different name or no name is specified by the target type '(int a, string)'.
// (int a, string) x2 = (1, b: null);
Diagnostic(ErrorCode.WRN_TupleLiteralNameMismatch, "b: null").WithArguments("b", "(int a, string)").WithLocation(7, 34),
// (6,22): warning CS0219: The variable 'x1' is assigned but its value is never used
Expand Down
4 changes: 2 additions & 2 deletions src/Compilers/VisualBasic/Portable/VBResources.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/Compilers/VisualBasic/Portable/VBResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -5426,10 +5426,10 @@
<value>Tuple element names must be unique.</value>
</data>
<data name="WRN_TupleLiteralNameMismatch" xml:space="preserve">
<value>The tuple element name '{0}' is ignored because a different name is specified by the target type '{1}'.</value>
<value>The tuple element name '{0}' is ignored because a different name or no name is specified by the target type '{1}'.</value>
</data>
<data name="WRN_TupleLiteralNameMismatch_Title" xml:space="preserve">
<value>The tuple element name is ignored because a different name is specified by the assignment target.</value>
<value>The tuple element name is ignored because a different name or no name is specified by the assignment target.</value>
</data>
<data name="ERR_TupleReservedElementName" xml:space="preserve">
<value>Tuple element name '{0}' is only allowed at position {1}.</value>
Expand Down
Loading

0 comments on commit 4af3f92

Please sign in to comment.