-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Create TypedTreeMap that propagates types #144
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
Conversation
@odersky please review |
Terminology: Maybe call it RetypingTreeMap? Propagating is ambiguous: the standard TreeMap also propagates types, but from old to new tree instead of from children to parent. |
It doesn't actually retype it, so I believe that |
On Sat, Jul 19, 2014 at 2:01 PM, Dmitry Petrashko [email protected]
It runs a type assigner over it. I think retyping expresses that well.
Martin Odersky |
I am going to touch up and merge this one. |
I've got a restructured version coming. Let me push it. |
@odersky I've pushed the updated version. |
case TypeApply(fun, args) => | ||
cpy.TypeApply(tree, transform(fun), transform(args)) | ||
case New(tpt) => | ||
cpy.New(tree, transform(tpt)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why duplicate these cases? I mean, why not simply do a super.transform for any missing cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No good reason, I'll make the change.
Incorporated commits from scala#144. The logic here is very similar, modulo some minor organization and naming changes. The only deeper difference concerns retypeSelect, which here makes use of derivedSelect without changing kinds of tree nodes.
Incorporated commits from scala#144. The logic here is very similar, modulo some minor organization and naming changes. The only deeper difference concerns retypeSelect, which here makes use of derivedSelect without changing kinds of tree nodes.
Incorporated commits from scala#144. The logic here is very similar, modulo some minor organization and naming changes. The only deeper difference concerns retypeSelect, which here makes use of derivedSelect without changing kinds of tree nodes.
If some node in tree is transformed changing the type, the outer node could potentially also change type. This patch implements a RetypingTreeMap that propagates those changes until types converge. Propagation is done for tree nodes that are able to compute their type based on their children: Pair, Block, If, Match, CaseDef, Try, SeqLiteral, Annotated, Select.
Backport "Type avoidance in MT bound inference" to 3.3 LTS
If some node in tree is transformed changing the type,
the outer node could potentially also change type.
This patch implements a TypedTreeMap that propagates those
changes until types converge. Propagation is done for tree nodes
that are able to compute their type based on their children:
Pair, Block, If, Match, CaseDef, Try, SeqLiteral, Annotated
Note: patch doesn't cover Select's, see #143 for the issue
with Select.