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 @@ -529,7 +529,7 @@ private void CheckBaseTypeCompliance(NamedTypeSymbol symbol)
else
{
NamedTypeSymbol baseType = symbol.EnumUnderlyingType ?? symbol.BaseTypeNoUseSiteDiagnostics; // null for interfaces
System.Diagnostics.Debug.Assert((object)baseType != null || symbol.SpecialType == SpecialType.System_Object, "Only object has no base.");
System.Diagnostics.Debug.Assert((object)baseType != null || symbol.SpecialType == SpecialType.System_Object || symbol.IsExtension, "Only object or extension has no base.");
if ((object)baseType != null && !IsCompliantType(baseType, symbol))
{
// TODO: it would be nice to report this on the base type clause.
Expand Down
13 changes: 13 additions & 0 deletions src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionTests2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,19 @@ static void local<U>(U u, System.Linq.Expressions.Expression<System.Func<U, obje
CompileAndVerify(comp, expectedOutput: ExpectedOutput("{ A = 43 }"), verify: Verification.Skipped).VerifyDiagnostics();
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/80250")]
public void Cls()
{
var src = """
[assembly: System.CLSCompliant(true)]
public static class Extensions
{
extension(object) { }
}
""";
CreateCompilation(src).VerifyEmitDiagnostics();
}

[Fact]
public void Attribute_01()
{
Expand Down