Related error spans for derived members in interfaces/classes (original) (raw)

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

and this gets reported on the base type member.