Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5493,7 +5493,7 @@ [new BoundExpressionWithNullability(leftOperand.Syntax, leftOperand, leftUnderly
derivedType = derivedType.StrippedType();
var discardedUseSiteInfo = CompoundUseSiteInfo<AssemblySymbol>.Discarded;
var conversion = _conversions.ClassifyBuiltInConversion(derivedType, baseType, isChecked: false, ref discardedUseSiteInfo);
if (conversion.Exists && !conversion.IsExplicit)
if (conversion.Kind is ConversionKind.Identity or ConversionKind.ImplicitReference)
{
return derivedType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147317,6 +147317,40 @@ class Program
);
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80255")]
public void ReinferMethod_Span_01()
{
var source = """
#nullable enable
using System;
class C
{
bool M(ReadOnlySpan<int> a, Span<int> b)
{
return b == a;
}
}
""";
CreateCompilation(source, targetFramework: TargetFramework.Net90).VerifyDiagnostics();
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80255")]
public void ReinferMethod_Span_02()
{
var source = """
#nullable enable
using System;
class C
{
bool M(ReadOnlySpan<int> a, Span<int> b)
{
return a == b;
}
}
""";
CreateCompilation(source, targetFramework: TargetFramework.Net90).VerifyDiagnostics();
}

[Fact]
[WorkItem(38726, "https://github.com/dotnet/roslyn/issues/38726")]
public void CollectionInitializerBoxingConversion()
Expand Down