We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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))
We should get a valid type representing the Color enum.
What is weird is that Interactive.pathTo gives us:
Interactive.pathTo
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.
The text was updated successfully, but these errors were encountered:
This may be because the first statement of an enum class template in the AST is an import statement of the cases, (its synthetic) which is probably overlapping the span for the actual cases. https://github.com/lampepfl/dotty/blob/2961f69fe2805d8901103496f588d976f212d8ac/compiler/src/dotty/tools/dotc/ast/Desugar.scala#L521
Sorry, something went wrong.
You should be able to set a zero-extent span to that tree so pathTo skips over it.
Set zero span for synthetic enum import selector
c73ed36
Fixes scala#11683
Successfully merging a pull request may close this issue.
Uh oh!
There was an error while loading. Please reload this page.
Minimized code
Running:
on
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:while there are no actual imports.
The text was updated successfully, but these errors were encountered: