Skip to content

Related error spans for derived members in interfaces/classes #25033

Open
@DanielRosenwasser

Description

@DanielRosenwasser

Now that we support multiple related spans for errors (#10489, #22789, #24548), we'd like to improve an existing error message.

Currently, we provide certain errors for when a derived type incorrectly overrides/implements a member from the base type:

Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.
Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.
Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.
Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.
Property '{0}' in type '{1}' is not assignable to the same property in base type '{2}'.

We can actually provide the base type's member as a related span location for some extra context.

'{0}' redefines '{1}' in an incompatible way.

Where

  • 0 is the derived type
  • 1 is the member name

and this gets reported on the base type member.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions