Skip to content

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.
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?

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.
DarkDimius added a commit that referenced this pull request Apr 17, 2015
@DarkDimius DarkDimius merged commit 4d60c90 into scala:master Apr 17, 2015
tgodzik added a commit to tgodzik/scala3 that referenced this pull request Jul 23, 2025
Backport "Normalize tuple types in var args seq literals and classOf instances" to 3.3 LTS
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