diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs index 538c8dbea44e88f801a4b6e8061a76f6263fb0dd..d1422633480515b0207e3a27e798b25e7c242772 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs @@ -19929,6 +19929,66 @@ static void M() ); } + [Fact] + [WorkItem(14888, "https://github.com/dotnet/roslyn/issues/14888")] + public void Iterator_01() + { + var source = @" +using System; +using System.Collections.Generic; + +public class C +{ + static void Main(string[] args) + { + foreach (var x in entries()) + { + Console.WriteLine(x); + } + } + + static public IEnumerable<(int, int)> entries() + { + yield return (1, 2); + } +} +"; + + var comp = CompileAndVerify(source, + additionalRefs: s_valueTupleRefs, + parseOptions: TestOptions.Regular, expectedOutput: @"(1, 2)"); + } + + [Fact] + [WorkItem(14888, "https://github.com/dotnet/roslyn/issues/14888")] + public void Iterator_02() + { + var source = @" +using System; +using System.Collections.Generic; + +public class C +{ + public IEnumerable<(int, int)> entries() + { + yield return (1, 2); + } +} +"; + + var compilation = CreateCompilationWithMscorlib(source, + references: new[] { ValueTupleRef }); + + compilation.VerifyEmitDiagnostics( + // (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'. + // public IEnumerable<(int, int)> entries() + Diagnostic(ErrorCode.ERR_NoTypeDef, "(int, int)").WithArguments("System.ValueType", "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a").WithLocation(7, 24), + // (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'. + // yield return (1, 2); + Diagnostic(ErrorCode.ERR_NoTypeDef, "(1, 2)").WithArguments("System.ValueType", "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a").WithLocation(9, 22) + ); + } + [Fact] [WorkItem(14649, "https://github.com/dotnet/roslyn/issues/14649")] public void ParseLongLambda() diff --git a/src/Compilers/VisualBasic/Portable/Binding/Binder_Symbols.vb b/src/Compilers/VisualBasic/Portable/Binding/Binder_Symbols.vb index 73b98cb55177e7120ad133725ea84b5dc15969c4..0087d010fb5271a761c4fb86eb73fef8801820c2 100644 --- a/src/Compilers/VisualBasic/Portable/Binding/Binder_Symbols.vb +++ b/src/Compilers/VisualBasic/Portable/Binding/Binder_Symbols.vb @@ -379,9 +379,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' When we bind generic type reference, we pass through here with symbols for ' the generic type definition, each type argument and for the final constructed ' symbol. To avoid reporting duplicate diagnostics in this scenario, report use - ' site errors only on a definition. ' + ' site errors only on a definition. If Not reportedAnError AndAlso Not suppressUseSiteError AndAlso - Not typeSymbol.IsArrayType() AndAlso typeSymbol.IsDefinition Then + Not typeSymbol.IsArrayType() AndAlso Not typeSymbol.IsTupleType AndAlso typeSymbol.IsDefinition Then ReportUseSiteError(diagBag, typeSyntax, typeSymbol) End If diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb index e78051ef44db0bf96a5ec5e1a10fe86dd16de787..540a6fe46619d2aec17aac289cc113099840d77e 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb @@ -355,18 +355,12 @@ End Module comp.AssertTheseDiagnostics( -BC37267: Predefined type 'ValueTuple(Of ,)' is not defined or imported. - Dim t as (Integer, Integer) - ~~~~~~~~~~~~~~~~~~ BC37267: Predefined type 'ValueTuple(Of ,)' is not defined or imported. Dim t as (Integer, Integer) ~~~~~~~~~~~~~~~~~~ BC37267: Predefined type 'ValueTuple(Of ,)' is not defined or imported. Dim t1 as (A As Integer, B As Integer) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -BC37267: Predefined type 'ValueTuple(Of ,)' is not defined or imported. - Dim t1 as (A As Integer, B As Integer) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BC37268: 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? Dim t1 as (A As Integer, B As Integer) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -4377,9 +4371,6 @@ BC37267: Predefined type 'ValueTuple(Of )' is not defined or imported. BC37267: Predefined type 'ValueTuple(Of ,,,,,,,)' is not defined or imported. Dim x As (Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer) = ("Alice", 2, 3, 4, 5, 6, 7, 8) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -BC37267: Predefined type 'ValueTuple(Of ,,,,,,,)' is not defined or imported. - Dim x As (Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer) = ("Alice", 2, 3, 4, 5, 6, 7, 8) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BC37267: Predefined type 'ValueTuple(Of )' is not defined or imported. Dim x As (Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer) = ("Alice", 2, 3, 4, 5, 6, 7, 8) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -4392,9 +4383,6 @@ BC37267: Predefined type 'ValueTuple(Of )' is not defined or imported. BC37267: Predefined type 'ValueTuple(Of ,,,,,,,)' is not defined or imported. Dim y As (Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer) = (1, 2, 3, 4, 5, 6, 7, 8) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -BC37267: Predefined type 'ValueTuple(Of ,,,,,,,)' is not defined or imported. - Dim y As (Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer) = (1, 2, 3, 4, 5, 6, 7, 8) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BC37267: Predefined type 'ValueTuple(Of )' is not defined or imported. Dim y As (Integer, Integer, Integer, Integer, Integer, Integer, Integer, Integer) = (1, 2, 3, 4, 5, 6, 7, 8) ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -5065,9 +5053,6 @@ End Module BC37267: Predefined type 'ValueTuple(Of ,)' is not defined or imported. Dim x As (Integer, String) = (1, "hello") ~~~~~~~~~~~~~~~~~ -BC37267: Predefined type 'ValueTuple(Of ,)' is not defined or imported. - Dim x As (Integer, String) = (1, "hello") - ~~~~~~~~~~~~~~~~~ BC37267: Predefined type 'ValueTuple(Of ,)' is not defined or imported. Dim x As (Integer, String) = (1, "hello") ~~~~~~~~~~~~ @@ -5476,9 +5461,6 @@ End Class comp.AssertTheseDiagnostics( -BC37267: Predefined type 'ValueTuple(Of ,)' is not defined or imported. - Public Shared Function M(Of T1, T2)() As (first As T1, second As T2) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ BC37267: Predefined type 'ValueTuple(Of ,)' is not defined or imported. Public Shared Function M(Of T1, T2)() As (first As T1, second As T2) ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -5563,9 +5545,6 @@ End Namespace comp.AssertTheseDiagnostics( -BC37267: Predefined type 'ValueTuple(Of ,,,,,,,)' is not defined or imported. - Function M(Of T1, T2, T3, T4, T5, T6, T7, T8, T9)() As (T1, T2, T3, T4, T5, T6, T7, T8, T9) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ BC37267: Predefined type 'ValueTuple(Of ,,,,,,,)' is not defined or imported. Function M(Of T1, T2, T3, T4, T5, T6, T7, T8, T9)() As (T1, T2, T3, T4, T5, T6, T7, T8, T9) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -16090,9 +16069,6 @@ End Class comp.AssertTheseDiagnostics( -BC37267: Predefined type 'ValueTuple(Of ,)' is not defined or imported. - Dim t As (Integer, Integer) = Nothing - ~~~~~~~~~~~~~~~~~~ BC37267: Predefined type 'ValueTuple(Of ,)' is not defined or imported. Dim t As (Integer, Integer) = Nothing ~~~~~~~~~~~~~~~~~~ @@ -17349,6 +17325,63 @@ BC30652: Reference required to assembly 'System.Runtime, Version=4.0.0.0, Cultur ) End Sub + + + Public Sub Iterator_01() + + Dim comp = CreateCompilationWithMscorlibAndVBRuntime( + + +Imports System +Imports System.Collections.Generic + +Public Class C + Shared Sub Main() + For Each x in Test() + Console.WriteLine(x) + Next + End Sub + + Shared Iterator Function Test() As IEnumerable(Of (integer, integer)) + yield (1, 2) + End Function +End Class + +, +options:=TestOptions.ReleaseExe, additionalRefs:=s_valueTupleRefs) + + CompileAndVerify(comp, expectedOutput:="(1, 2)") + End Sub + + + + Public Sub Iterator_02() + + Dim comp = CreateCompilationWithMscorlibAndVBRuntime( + + +Imports System +Imports System.Collections.Generic + +Public Class C + Iterator Function Test() As IEnumerable(Of (integer, integer)) + yield (1, 2) + End Function +End Class + +, additionalRefs:={ValueTupleRef}) + + comp.AssertTheseEmitDiagnostics( + +BC30652: Reference required to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' containing the type 'ValueType'. Add one to your project. + Iterator Function Test() As IEnumerable(Of (integer, integer)) + ~~~~~~~~~~~~~~~~~~ +BC30652: Reference required to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' containing the type 'ValueType'. Add one to your project. + yield (1, 2) + ~~~~~~ +) + End Sub + Public Sub UserDefinedConversionsAndNameMismatch_01() diff --git a/src/Tools/MicroBuild/publish-assets.ps1 b/src/Tools/MicroBuild/publish-assets.ps1 index 52724061be6b38ee5ca136be791670e08c655280..017bef0610e7835d264cd35692707a87d5074c36 100644 --- a/src/Tools/MicroBuild/publish-assets.ps1 +++ b/src/Tools/MicroBuild/publish-assets.ps1 @@ -40,7 +40,7 @@ try switch ($branchName) { - "dev15-rc" { } + "dev15-rc2" { } "master" { } default {