Skip to content

Interactive.pathTo shows ImportType for repeated enum case. #11683

Closed
@tgodzik

Description

@tgodzik

Minimized code

Running:

val pos = sourcePosition(driver, params, uri)
val trees = driver.openedTrees(uri)
val path = Interactive.pathTo(trees, pos)
val tp = Interactive.enclosingType(trees, pos)
val tpw = tp.widenTermRefExpr

on

object SimpleEnum:
  enum Color:
    case Re@@d, Green, Blue

will produce type tree:

val tpw = ImportType(Ident(Color))

Expectation

We should get a valid type representing the Color enum.

What is weird is that Interactive.pathTo gives us:

path.head == Import(Ident(Color),List(ImportSelector(Ident(Red),EmptyTree,EmptyTree), ImportSelector(Ident(Green),EmptyTree,EmptyTree), ImportSelector(Ident(Blue),EmptyTree,EmptyTree)))

while there are no actual imports.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions