Trees after typer losing information
See original GitHub issueCompiler version
3.1.3
Minimized code
object Main {
def foo: ArrayBuffer[Int] = ???
}
ArrayBuffer
is missing from imports.
Output
Parser tree
PackageDef(
pid = Ident(name = <empty>),
stats = List(
ModuleDef(
name = Main,
impl = Template(
constr = DefDef(
name = <init>,
paramss = List(),
tpt = TypeTree,
preRhs = Thicket(trees = List())
),
parentsOrDerived = List(),
self = ValDef(name = _, tpt = Thicket(trees = List()), preRhs = Thicket(trees = List())),
preBody = List(
DefDef(
name = foo,
paramss = List(),
tpt = AppliedTypeTree(tpt = Ident(name = ArrayBuffer), args = List(Ident(name = Int))),
preRhs = Ident(name = ???)
)
)
)
)
)
)
Notice tpt = AppliedTypeTree(tpt = Ident(name = ArrayBuffer), args = List(Ident(name = Int))),
<- AppliedTypeTree is available.
Typed tree though:
tree = TypeDef(
name = Main$,
rhs = Template(
constr = DefDef(
name = <init>,
paramss = List(List()),
tpt = TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Unit)],
preRhs = Thicket(trees = List())
),
parentsOrDerived = List(
Apply(
fun = Select(
qualifier = New(
tpt = TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class Object)]
),
name = <init>
),
args = List()
)
),
self = ValDef(
name = _,
tpt = SingletonTypeTree(ref = Ident(name = Main)),
preRhs = Thicket(trees = List())
),
preBody = List(
DefDef(
name = foo,
paramss = List(),
tpt = Ident(name = ArrayBuffer),
preRhs = Ident(name = ???)
)
)
)
),
Notice that the tpt of the DefDef is tpt = Ident(name = ArrayBuffer),
Seems that if the type is not available then we are missing TypeApply, which is useful for the IDE to figure out if we need to insert []
Expectation
TypeApply should still be available in tpt of DefDef. It might be an error type, but it should be available there.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Can these trees be saved? Tree recovery after a storm-Tree ...
Some trees simply can't be saved or are not worth saving. If the tree has already been weakened by disease, if the trunk...
Read more >Decision tree pruning - Wikipedia
Pruning is a data compression technique in machine learning and search algorithms that reduces the size of decision trees by removing sections of...
Read more >Why Are My Trees Shedding or Losing Leaves in Spring?
For some trees, spring leaf drop is perfectly normal, ... Fortunately, most tree types–including ash– can easily shake off anthracnose.
Read more >Lost trees, booster benefits — the week in infographics - Nature
Nearly one-third of tree species are threatened with extinction. This is more than twice the number of threatened mammals, birds, ...
Read more >Why deforestation matters—and what we can do to stop it
A movement is under way to preserve existing forest ecosystems and restore lost tree cover by first reforesting (replanting trees) and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dwijnand Seems like that did the trick! Thanks! https://github.com/lampepfl/dotty/pull/15825
I invite you to take a look at the problem this issue has caused in Metals, for the detection of existing type parameters, so that an extra type bracket is not inserted upon type completion. https://github.com/scalameta/metals/pull/4174#discussion_r930605632