Skip to content

Show Type Hierarchy displays explicitly subtypes #62120

@FMorschel

Description

@FMorschel

Repro:

class A1 {}

class B1 extends A1 {}
class C1 extends A1 implements B1 {}

class A2 {}

class B2 extends A2 {}
class C2 implements B2 {}

The first class hierarchy looks like this:

Image Image

The second class hierarchy looks like this:

Image Image

For both cases, C is a subtype of A. But we only display that directly under A (not only as a subtype of B) when we have an explicit extends/implements/with.

This feels a bit inconsistent to me. I'm not necessarily familiar with whether LSP asks for something specific or how other languages do this. But I'll advocate that we make both cases display the same way.

  • Either always display all subtypes in a full list
  • Or display only the explicit subtypes that are not subtypes of another explicit subtype

I'd personally vote for the second option because it avoids duplicated values (like the second screenshot). Not necessarily related, but it would go nicely with #61574, where we ask for exhaustiveness to do the same.

CC @DanTup @bwilkerson

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions