Skip to content

Commit b494eec

Browse files
author
msftbot[bot]
authored
Merge pull request #41832 from dotnet/merges/release/dev16.5-to-master
Merge release/dev16.5 to master
2 parents 019f8df + 5990228 commit b494eec

File tree

4 files changed

+66
-8
lines changed

4 files changed

+66
-8
lines changed

src/Compilers/CSharp/Portable/Symbols/Metadata/PE/TupleTypeDecoder.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,9 @@ private TypeSymbol DecodeType(TypeSymbol type)
159159
switch (type.Kind)
160160
{
161161
case SymbolKind.ErrorType:
162-
if (type.HasUseSiteError)
163-
{
164-
_foundUsableErrorType = true;
165-
}
162+
_foundUsableErrorType = true;
166163
return type;
164+
167165
case SymbolKind.DynamicType:
168166
case SymbolKind.TypeParameter:
169167
case SymbolKind.PointerType:

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26095,6 +26095,36 @@ public static void Main()
2609526095
CompileAndVerify(executeComp, expectedOutput: "ran");
2609626096
}
2609726097

26098+
[Fact]
26099+
[WorkItem(41699, "https://github.com/dotnet/roslyn/issues/41699")]
26100+
public void MissingBaseType_TupleTypeArgumentWithNames()
26101+
{
26102+
var sourceA =
26103+
@"public class A<T> { }";
26104+
var comp = CreateCompilation(sourceA, assemblyName: "A");
26105+
var refA = comp.EmitToImageReference();
26106+
26107+
var sourceB =
26108+
@"public class B : A<(object X, B Y)> { }";
26109+
comp = CreateCompilation(sourceB, references: new[] { refA });
26110+
var refB = comp.EmitToImageReference();
26111+
26112+
var sourceC =
26113+
@"class Program
26114+
{
26115+
static void Main()
26116+
{
26117+
var b = new B();
26118+
b.ToString();
26119+
}
26120+
}";
26121+
comp = CreateCompilation(sourceC, references: new[] { refB });
26122+
comp.VerifyDiagnostics(
26123+
// (6,11): error CS0012: The type 'A<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
26124+
// b.ToString();
26125+
Diagnostic(ErrorCode.ERR_NoTypeDef, "ToString").WithArguments("A<>", "A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(6, 11));
26126+
}
26127+
2609826128
[Fact]
2609926129
[WorkItem(21727, "https://github.com/dotnet/roslyn/issues/21727")]
2610026130
public void FailedDecodingOfTupleNamesWhenMissingValueTupleType()

src/Compilers/VisualBasic/Portable/Symbols/Metadata/PE/TupleTypeDecoder.vb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols.Metadata.PE
126126
Private Function DecodeType(type As TypeSymbol) As TypeSymbol
127127
Select Case type.Kind
128128
Case SymbolKind.ErrorType
129-
130-
If type.GetUseSiteErrorInfo() IsNot Nothing Then
131-
_foundUsableErrorType = True
132-
End If
129+
_foundUsableErrorType = True
133130
Return type
134131

135132
Case SymbolKind.DynamicType,

src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenTuples.vb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22800,6 +22800,39 @@ End Class
2280022800

2280122801
End Sub
2280222802

22803+
<Fact>
22804+
<WorkItem(41699, "https://github.com/dotnet/roslyn/issues/41699")>
22805+
Public Sub MissingBaseType_TupleTypeArgumentWithNames()
22806+
Dim sourceA =
22807+
"Public Class A(Of T)
22808+
End Class"
22809+
Dim comp = CreateCompilation(sourceA, assemblyName:="A")
22810+
Dim refA = comp.EmitToImageReference()
22811+
22812+
Dim sourceB =
22813+
"Public Class B
22814+
Inherits A(Of (X As Object, Y As B))
22815+
End Class"
22816+
comp = CreateCompilation(sourceB, references:={refA})
22817+
Dim refB = comp.EmitToImageReference()
22818+
22819+
Dim sourceC =
22820+
"Module Program
22821+
Sub Main()
22822+
Dim b = New B()
22823+
b.ToString()
22824+
End Sub
22825+
End Module"
22826+
comp = CreateCompilation(sourceC, references:={refB})
22827+
comp.AssertTheseDiagnostics(
22828+
"BC30456: 'ToString' is not a member of 'B'.
22829+
b.ToString()
22830+
~~~~~~~~~~
22831+
BC30652: Reference required to assembly 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' containing the type 'A(Of )'. Add one to your project.
22832+
b.ToString()
22833+
~~~~~~~~~~")
22834+
End Sub
22835+
2280322836
<Fact>
2280422837
<WorkItem(41207, "https://github.com/dotnet/roslyn/issues/41207")>
2280522838
<WorkItem(1056281, "https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1056281")>

0 commit comments

Comments
 (0)