Skip to content

Commit b19ecd7

Browse files
authored
Move to the real System.ValueTuple ref (#74936)
1 parent 5cba0ce commit b19ecd7

File tree

18 files changed

+132
-158
lines changed

18 files changed

+132
-158
lines changed

eng/Directory.Packages.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<MicrosoftCodeAnalysisNetAnalyzersVersion>8.0.0-preview.23468.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
66
<MicrosoftCodeAnalysisTestingVersion>1.1.3-beta1.24319.1</MicrosoftCodeAnalysisTestingVersion>
77
<MicrosoftVisualStudioExtensibilityTestingVersion>0.1.187-beta</MicrosoftVisualStudioExtensibilityTestingVersion>
8-
<_BasicReferenceAssembliesVersion>1.7.7</_BasicReferenceAssembliesVersion>
8+
<_BasicReferenceAssembliesVersion>1.7.8</_BasicReferenceAssembliesVersion>
99
<!-- CodeStyleAnalyzerVersion should we updated together with version of dotnet-format in dotnet-tools.json -->
1010
<CodeStyleAnalyzerVersion>4.8.0-3.final</CodeStyleAnalyzerVersion>
1111
<VisualStudioEditorPackagesVersion>17.10.191</VisualStudioEditorPackagesVersion>

src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs

+19-25
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ .assembly extern mscorlib { }
775775
.assembly extern System.ValueTuple
776776
{
777777
.publickeytoken = (CC 7B 13 FF CD 2D DD 51 )
778-
.ver 4:0:1:0
778+
.ver 4:0:3:0
779779
}
780780

781781
.class public auto ansi C
@@ -871,7 +871,7 @@ .assembly extern mscorlib { }
871871
.assembly extern System.ValueTuple
872872
{
873873
.publickeytoken = (CC 7B 13 FF CD 2D DD 51 )
874-
.ver 4:0:1:0
874+
.ver 4:0:3:0
875875
}
876876

877877
.class public auto ansi C
@@ -969,7 +969,7 @@ .assembly extern mscorlib { }
969969
.assembly extern System.ValueTuple
970970
{
971971
.publickeytoken = (CC 7B 13 FF CD 2D DD 51 )
972-
.ver 4:0:1:0
972+
.ver 4:0:3:0
973973
}
974974

975975
.class public auto ansi beforefieldinit Base`1<T>
@@ -21205,7 +21205,7 @@ .assembly extern mscorlib { }
2120521205
.assembly extern System.ValueTuple
2120621206
{
2120721207
.publickeytoken = (CC 7B 13 FF CD 2D DD 51 )
21208-
.ver 4:0:1:0
21208+
.ver 4:0:3:0
2120921209
}
2121021210

2121121211
.class public auto ansi beforefieldinit Base
@@ -22273,9 +22273,9 @@ public class B
2227322273

2227422274
var comp = CreateCompilationWithMscorlib40(source, references: new[] { lib.ToMetadataReference() });
2227522275
comp.VerifyDiagnostics(
22276-
// (4,24): error CS0012: The type '(, )' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
22276+
// (4,24): error CS0012: The type '(, )' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
2227722277
// void M2() { return A.M(); }
22278-
Diagnostic(ErrorCode.ERR_NoTypeDef, "A.M").WithArguments("(, )", "System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51").WithLocation(4, 24)
22278+
Diagnostic(ErrorCode.ERR_NoTypeDef, "A.M").WithArguments("(, )", "System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51").WithLocation(4, 24)
2227922279
);
2228022280

2228122281
var methodM = comp.GetMember<MethodSymbol>("A.M");
@@ -22313,9 +22313,9 @@ public class B
2231322313

2231422314
var comp = CreateCompilationWithMscorlib40(source, references: new[] { lib.ToMetadataReference() });
2231522315
comp.VerifyDiagnostics(
22316-
// (4,24): error CS0012: The type '(, )' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
22316+
// (4,24): error CS0012: The type '(, )' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
2231722317
// void M2() { return A.M(); }
22318-
Diagnostic(ErrorCode.ERR_NoTypeDef, "A.M").WithArguments("(, )", "System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51").WithLocation(4, 24)
22318+
Diagnostic(ErrorCode.ERR_NoTypeDef, "A.M").WithArguments("(, )", "System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51").WithLocation(4, 24)
2231922319
);
2232022320

2232122321
var methodM = comp.GetMember<MethodSymbol>("A.M");
@@ -23145,7 +23145,7 @@ public void ValueTupleBaseError_NoSystemRuntime()
2314523145
{
2314623146
((int, int), (int, int)) F();
2314723147
}";
23148-
var comp = CreateCompilationWithMscorlib40(source, references: new[] { ValueTupleRef });
23148+
var comp = CreateCompilationWithMscorlib40(source, references: [ValueTupleLegacyRef]);
2314923149
comp.VerifyEmitDiagnostics(
2315023150
// (3,6): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
2315123151
// ((int, int), (int, int)) F();
@@ -23766,7 +23766,7 @@ .assembly extern System.Core
2376623766
.assembly extern System.ValueTuple
2376723767
{
2376823768
.publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) // .{...-.Q
23769-
.ver 4:0:1:0
23769+
.ver 4:0:3:0
2377023770
}
2377123771

2377223772
// =============== CLASS MEMBERS DECLARATION ===================
@@ -23923,16 +23923,14 @@ static void M()
2392323923
}
2392423924
";
2392523925

23926-
var compilation = CreateCompilationWithMscorlib40(source,
23927-
references: new[] { ValueTupleRef });
23926+
var compilation = CreateCompilationWithMscorlib40(source, references: [ValueTupleLegacyRef]);
2392823927

2392923928
Assert.Equal(TypeKind.Class, compilation.GetWellKnownType(WellKnownType.System_ValueTuple_T2).TypeKind);
2393023929

2393123930
compilation.VerifyDiagnostics(
23932-
// (6,17): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
23933-
// var o = (1, 2);
23934-
Diagnostic(ErrorCode.ERR_NoTypeDef, "(1, 2)").WithArguments("System.ValueType", "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a").WithLocation(6, 17)
23935-
);
23931+
// (6,17): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
23932+
// var o = (1, 2);
23933+
Diagnostic(ErrorCode.ERR_NoTypeDef, "(1, 2)").WithArguments("System.ValueType", "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a").WithLocation(6, 17));
2393623934
}
2393723935

2393823936
[Fact]
@@ -23969,7 +23967,6 @@ static void Main(string[] args)
2396923967
public void Iterator_02()
2397023968
{
2397123969
var source = @"
23972-
using System;
2397323970
using System.Collections.Generic;
2397423971

2397523972
public class C
@@ -23981,17 +23978,14 @@ public class C
2398123978
}
2398223979
";
2398323980

23984-
var compilation = CreateCompilationWithMscorlib40(source,
23985-
references: new[] { ValueTupleRef });
23986-
23981+
var compilation = CreateCompilationWithMscorlib40(source, references: new[] { ValueTupleLegacyRef });
2398723982
compilation.VerifyEmitDiagnostics(
23988-
// (7,24): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
23983+
// (6,24): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
2398923984
// public IEnumerable<(int, int)> entries()
23990-
Diagnostic(ErrorCode.ERR_NoTypeDef, "(int, int)").WithArguments("System.ValueType", "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a").WithLocation(7, 24),
23991-
// (9,22): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
23985+
Diagnostic(ErrorCode.ERR_NoTypeDef, "(int, int)").WithArguments("System.ValueType", "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a").WithLocation(6, 24),
23986+
// (8,22): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
2399223987
// yield return (1, 2);
23993-
Diagnostic(ErrorCode.ERR_NoTypeDef, "(1, 2)").WithArguments("System.ValueType", "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a").WithLocation(9, 22)
23994-
);
23988+
Diagnostic(ErrorCode.ERR_NoTypeDef, "(1, 2)").WithArguments("System.ValueType", "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a").WithLocation(8, 22));
2399523989
}
2399623990

2399723991
[Fact]

src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Tuples.cs

+18-18
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,12 @@ class C
221221
// (4,12): error CS0518: Predefined type 'System.String' is not defined or imported
222222
// static (int x, int y) M() => (0, 0);
223223
Diagnostic(ErrorCode.ERR_PredefinedTypeNotFound, "(int x, int y)").WithArguments("System.String").WithLocation(4, 12),
224-
// (4,12): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
224+
// (4,12): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
225225
// static (int x, int y) M() => (0, 0);
226-
Diagnostic(ErrorCode.ERR_NoTypeDef, "(int x, int y)").WithArguments("System.ValueType", "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a").WithLocation(4, 12),
227-
// (4,34): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
226+
Diagnostic(ErrorCode.ERR_NoTypeDef, "(int x, int y)").WithArguments("System.ValueType", "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089").WithLocation(4, 12),
227+
// (4,34): error CS0012: The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
228228
// static (int x, int y) M() => (0, 0);
229-
Diagnostic(ErrorCode.ERR_NoTypeDef, "(0, 0)").WithArguments("System.ValueType", "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a").WithLocation(4, 34)
229+
Diagnostic(ErrorCode.ERR_NoTypeDef, "(0, 0)").WithArguments("System.ValueType", "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089").WithLocation(4, 34)
230230
);
231231
}
232232

@@ -816,34 +816,34 @@ public struct S
816816
}";
817817
var comp = CreateCompilationWithMscorlib40(text, references: s_attributeRefs);
818818
comp.VerifyDiagnostics(
819-
// (31,2): error CS8331: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
820-
// [TupleElementNames(new[] { "a", "b" })]
821-
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, @"TupleElementNames(new[] { ""a"", ""b"" })").WithLocation(31, 2),
822-
// (5,2): error CS8331: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
819+
// (5,2): error CS8138: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
823820
// [TupleElementNames(new[] { "a", "b" })]
824821
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, @"TupleElementNames(new[] { ""a"", ""b"" })").WithLocation(5, 2),
825-
// (18,10): error CS8331: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
822+
// (31,2): error CS8138: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
823+
// [TupleElementNames(new[] { "a", "b" })]
824+
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, @"TupleElementNames(new[] { ""a"", ""b"" })").WithLocation(31, 2),
825+
// (18,10): error CS8138: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
826826
// [TupleElementNames(new[] { "x" })]ValueTuple<T> args);
827827
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, @"TupleElementNames(new[] { ""x"" })").WithLocation(18, 10),
828-
// (11,6): error CS8331: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
828+
// (11,6): error CS8138: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
829829
// [TupleElementNames(new[] { "x", "y" })]
830830
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, @"TupleElementNames(new[] { ""x"", ""y"" })").WithLocation(11, 6),
831-
// (14,14): error CS8331: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
831+
// (14,14): error CS8138: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
832832
// [return: TupleElementNames(new string[] { null, null })]
833833
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, "TupleElementNames(new string[] { null, null })").WithLocation(14, 14),
834-
// (15,36): error CS8331: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
834+
// (15,36): error CS8138: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
835835
// public ValueTuple<int, int> M([TupleElementNames(new string[] { null})] ValueTuple x) => (0, 0);
836836
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, "TupleElementNames(new string[] { null})").WithLocation(15, 36),
837-
// (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.
837+
// (20,6): error CS8138: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
838838
// [TupleElementNames(new[] { "y" })]
839-
Diagnostic(ErrorCode.ERR_AttributeOnBadSymbolType, "TupleElementNames").WithArguments("TupleElementNames", "class, struct, property, indexer, field, parameter, return").WithLocation(20, 6),
840-
// (27,6): error CS8331: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
839+
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, @"TupleElementNames(new[] { ""y"" })").WithLocation(20, 6),
840+
// (27,6): error CS8138: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
841841
// [TupleElementNames(new[] { "a", "b" })]
842842
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, @"TupleElementNames(new[] { ""a"", ""b"" })").WithLocation(27, 6),
843-
// (28,33): error CS8331: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
843+
// (28,33): error CS7036: There is no argument given that corresponds to the required parameter 'transformNames' of 'TupleElementNamesAttribute.TupleElementNamesAttribute(string[])'
844844
// public (int x, int y) this[[TupleElementNames](int a, int b) t] => t;
845-
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, "TupleElementNames").WithLocation(28, 33),
846-
// (8,6): error CS8331: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
845+
Diagnostic(ErrorCode.ERR_NoCorrespondingArgument, "TupleElementNames").WithArguments("transformNames", "System.Runtime.CompilerServices.TupleElementNamesAttribute.TupleElementNamesAttribute(string[])").WithLocation(28, 33),
846+
// (8,6): error CS8138: Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.
847847
// [TupleElementNames(new string[] { null, null })]
848848
Diagnostic(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, "TupleElementNames(new string[] { null, null })").WithLocation(8, 6));
849849
}

src/Compilers/CSharp/Test/Symbol/Symbols/Source/CustomModifierCopyTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ public void TupleWithCustomModifiersInInterfaceMethod()
974974
var il = @"
975975
.assembly extern mscorlib { .ver 4:0:0:0 .publickeytoken = (B7 7A 5C 56 19 34 E0 89) }
976976
.assembly extern System.Core {}
977-
.assembly extern System.ValueTuple { .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) .ver 4:0:1:0 }
977+
.assembly extern System.ValueTuple { .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) .ver 4:0:3:0 }
978978
.assembly '<<GeneratedFileName>>' { }
979979
980980
.class interface public abstract auto ansi I
@@ -1092,7 +1092,7 @@ public void TupleWithCustomModifiersInInterfaceProperty()
10921092
var il = @"
10931093
.assembly extern mscorlib { .ver 4:0:0:0 .publickeytoken = (B7 7A 5C 56 19 34 E0 89) }
10941094
.assembly extern System.Core {}
1095-
.assembly extern System.ValueTuple { .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) .ver 4:0:1:0 }
1095+
.assembly extern System.ValueTuple { .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) .ver 4:0:3:0 }
10961096
.assembly '<<GeneratedFileName>>' { }
10971097
10981098
.class interface public abstract auto ansi I
@@ -1189,7 +1189,7 @@ public void TupleWithCustomModifiersInOverride()
11891189
var il = @"
11901190
.assembly extern mscorlib { .ver 4:0:0:0 .publickeytoken = (B7 7A 5C 56 19 34 E0 89) }
11911191
.assembly extern System.Core {}
1192-
.assembly extern System.ValueTuple { .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) .ver 4:0:1:0 }
1192+
.assembly extern System.ValueTuple { .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) .ver 4:0:3:0 }
11931193
.assembly '<<GeneratedFileName>>' { }
11941194
11951195
.class public auto ansi beforefieldinit Base

0 commit comments

Comments
 (0)