Skip to content

Fix #480 in LambdaLift #486

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 4 commits into from
Apr 17, 2015
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Apr 17, 2015

Fix two errors, where the first masked the second:

  1. Variables defined in a method are not free variables of that method. This was mispredicated before
    and caused liftedOwner to be updated to the class enclosing the method, thereby preventing any method
    that refers to a local parameter or symbol to be hoisted.

Once this was fixed, methods were hoisted too far out. Test case in #480a, which takes code from Definitions. This was fixed by

  1. markFree is updated to do an additional narrowLiftedOwner so that, if a free variable gets a proxy
    in an enclosing class, any inner classes and methods are kept within that class.

@review by @DarkDimius

Fix two errors, where the first masked the second:

1) Variables defined in a method are not free variables of that method. This was mispredicated before
and caused liftedOwner to be updated to the class enclosing the method, thereby preventing any method
that refers to a local parameter or symbol to be hoisted.

Once this was fixed, methods were hoisted too far out. Test case in #480a, which takes code from Definitions.
This was fixed by

2) markFree is updated to do an additional narrowLiftedOwner so that, if a free variable gets a proxy
in an enclosing class, any inner classes and methods are kept within that class.
* and the owner of `sym`.
* Return `true` if there is no class between `enclosure` and
* the owner of sym.
* and the owner of `sym`. Also, update lifted owner of `enclosure` so
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a class between enclosures owner and the owner of sym

It is still no clear that method follows the contract. The method does not reffer to the sym.owner at all, instead it uses sym.enclosingClass.

I believe that this is an important method which needs a more verbose documentation, both for the contract and for the implementation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd better change lifted owner of enclosure to
value of liftedOwner(enclosure), to make it clear that the map is updated, not the symbol.

@DarkDimius
Copy link
Contributor

can you also have a look on #342?

if (enclosure.is(PackageClass)) enclosure
else markFree(sym, enclosure.skipConstructor.enclosure)
if (intermediate.exists) {
narrowLiftedOwner(enclosure, intermediate)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you either add documentation to narrowLiftedOwner method, or add description what happens in both branches of this if?

@odersky
Copy link
Contributor Author

odersky commented Apr 17, 2015

@DarkDimius all reviewer comments should be addressed by now. I'll have a look at #342 independently.

@odersky
Copy link
Contributor Author

odersky commented Apr 17, 2015

Now #432 should also be fixed.

@odersky
Copy link
Contributor Author

odersky commented Apr 17, 2015

@DarkDimius Can you check which of the other lambda lift related issues are still open?

@DarkDimius
Copy link
Contributor

@odersky Did you mean #342? If yes, please update commit message.

@DarkDimius
Copy link
Contributor

Same applies to test name.

@DarkDimius
Copy link
Contributor

Otherwise LGTM. It seems that we have no open issues with lambdaLift left.
I'll do changes on my own and merge.

odersky added 3 commits April 17, 2015 21:30
Documentation around markFree and narrowLiftedOwner was added.
i480 was minimzed and dependencies on dotc were removed. (+1 squashed commit)
Squashed commits:
[1a84054] Test cases for scala#480
After lambdaLift, methods are no longer local to cosntructors, so their
inSuperCall flag is reset.
Idents of lifted symbols become class members, need to carry the right
reference with the right prefix as type.
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