Skip to content

Flatten lifts out anonymous module vals without making sure that lifted names do not conflict #415

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

Closed
DarkDimius opened this issue Mar 18, 2015 · 6 comments

Comments

@DarkDimius
Copy link
Contributor

Shown by ./tests/pos/zoo.scala

checking ./tests/pos/zoo.scala after phase TreeTransform:{LazyVals, seqLiterals, intercepted, literalize, getters, elimByName, resolveSuper}
checking ./tests/pos/zoo.scala after phase TreeTransform:{mixin, memoize, capturedVars, constructors}
checking ./tests/pos/zoo.scala after phase TreeTransform:{lambdaLift, flatten, restoreScopes}
[error] module val defined twice module $anon 9922 9917
[error] module val defined twice module $anon 9927 9922
[error] module val defined twice module $anon 9932 9927
@odersky
Copy link
Contributor

odersky commented Mar 22, 2015

This should be solved by #420 @DarkDimius can you check and close the issue if that's the case?

@DarkDimius
Copy link
Contributor Author

After applying 7b6964a the problem persists.

@odersky
Copy link
Contributor

odersky commented Mar 22, 2015

After some investigation, it looks like the test checks the wrong condition. Module vals are not lifted out; they remain in the scope where they were defined first. So there's no reason why they should have unique names.

@DarkDimius
Copy link
Contributor Author

The check suggests that they start to clash only after flatten, that is, before flatten the names were unique. If they are not lifted out, what made them clash?

@odersky
Copy link
Contributor

odersky commented Mar 22, 2015

This: (in TreeChecker)

  • if* (this.flatClasses || !(sym.isAnonymousFunction ||
    sym.isAnonymousClass || sym.isAnonymousModuleVal))
printError(s"$typ defined twice $sym ${sym.id} ${registry(name).id}"

)

On Sun, Mar 22, 2015 at 7:00 PM, Dmitry Petrashko [email protected]
wrote:

The check suggests that they start to clash with names only after flatten,
that is, before flatten the names were unique. If they are not lifted out,
what made them clash?


Reply to this email directly or view it on GitHub
#415 (comment).

Martin Odersky
EPFL

@DarkDimius
Copy link
Contributor Author

ahh, I get it.
I'll remove this check.
Thanks for investigation.

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

No branches or pull requests

2 participants