Skip to content

Fix #6213: Convert RefinedTypeTrees to TypeTrees in ReTyper #6249

New issue

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

Merged
merged 1 commit into from
Apr 7, 2019

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Apr 6, 2019

The standard treatment of RefinedTypeTrees creates a class definition, typechecks it
and then extracts the type from that. The class definition does not form part of the
resulting tree. This treatment is not workable for ReTyper since ReTyper is not prepared
to typecheck fresh class definitions from scratch. We avoid the problem by having
ReTyper convert the RefinedTypeTree to a TypeTree instead, keeping just the type.

Note: The only reason why Typer does not do the same thing is so that we can keep
the refinements as trees for IDE navigation. But that's not necessary for trees
that have undergone a ReTyper step (i.e. typically inlined trees).

The standard treatment of RefinedTypeTrees creates a class definition, typechecks it
and then extracts the type from that. The class definition does not form part of the
resulting tree. This treatment is not workable for ReTyper since ReTyper is not prepared
to typecheck fresh class definitions from scratch. We avoid the problem by having
ReTyper convert the RefinedTypeTree to a TypeTree instead, keeping just the type.

Note: The only reason why Typer does not do the same thing is so that we can keep
the refinements as trees for IDE navigation. But that's not necessary for trees
that have undergone a ReTyper step (i.e. typically inlined trees).
@milessabin
Copy link
Contributor

LGTM ... I was close, but I missed that it would be safe to convert the RefinedTypeTree to a plain TypeTree.

@milessabin milessabin merged commit 574fd0c into scala:master Apr 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants