Skip to content

Improve diagnostic quality for less accessible base type argument #40977

@333fred

Description

@333fred
class A { }
public class B<T> { }
public class C : B<A> { }

Currently, the error is:

Severity Code    Description
Error    CS0060  Inconsistent accessibility: base class 'B<A>' is less accessible than class 'C'

This isn't great wording. It's the type argument of the base class that's less accessible, but the wording implies that it's B<T> itself that's less accessible. The error should explicitly call out the type argument as the thing not accessible.

If someone from the community is interested in improving this, a change would need to be made around here: https://github.com/dotnet/roslyn/blob/master/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol_Bases.cs#L316-L320, splitting this up into multiple checks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-CompilersConcept-Diagnostic ClarityThe issues deals with the ease of understanding of errors and warnings.Feature Requesthelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions