var comp = CreateCompilationWithMscorlib(source, references: new[] { ValueTupleRef });
comp.VerifyEmitDiagnostics(
// (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'.
// (3,18): 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'.
// (3,5): 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 void ValueTupleBaseError_MissingReference()
{
var source0 =
@"public class A
{
}
public class B
{
}";
var comp0 = CreateCompilationWithMscorlib(source0, assemblyName: "92872377-08d1-4723-8906-a43b03e56ed3");
comp0.VerifyDiagnostics();
var ref0 = comp0.EmitToImageReference();
var source1 =
@"public class C<T>
{
}
namespace System
{
public class ValueTuple<T1, T2> : A
{
public ValueTuple(T1 _1, T2 _2) { }
}
public class ValueTuple<T1, T2, T3> : C<B>
{
public ValueTuple(T1 _1, T2 _2, T3 _3) { }
}
}";
var comp1 = CreateCompilationWithMscorlib(source1, references: new[] { ref0 });
comp1.VerifyDiagnostics();
var ref1 = comp1.EmitToImageReference();
var source =
@"interface I
{
(int, (int, int), (int, int)) F();
}";
var comp = CreateCompilationWithMscorlib(source, references: new[] { ref1 });
comp.VerifyEmitDiagnostics(
// error CS0012: The type 'B' is defined in an assembly that is not referenced. You must add a reference to assembly '92872377-08d1-4723-8906-a43b03e56ed3, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
// error CS0012: The type 'A' is defined in an assembly that is not referenced. You must add a reference to assembly '92872377-08d1-4723-8906-a43b03e56ed3, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
@@ -17280,6 +17280,149 @@ BC37281: Predefined type 'ValueTuple`2' must be a structure.
End Sub
<Fact>
Public Sub ValueTupleBaseError_NoSystemRuntime()
Dim comp = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb">
Interface I
Function F() As ((Integer, Integer), (Integer, Integer))
End Interface
</file>
</compilation>,
references:={ValueTupleRef})
comp.AssertTheseEmitDiagnostics(
<errors>
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.
Function F() As ((Integer, Integer), (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.
Function F() As ((Integer, Integer), (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.
Function F() As ((Integer, Integer), (Integer, Integer))
Function F() As (Integer, (Integer, Integer), (Integer, Integer))
End Interface
</file>
</compilation>,
references:={ref1})
comp.AssertTheseEmitDiagnostics(
<errors>
BC30652: Reference required to assembly '5a03232e-1a0f-4d1b-99ba-5d7b40ea931e, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' containing the type 'A'. Add one to your project.
BC30652: Reference required to assembly '5a03232e-1a0f-4d1b-99ba-5d7b40ea931e, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' containing the type 'B'. Add one to your project.