Skip to content

invalid change of parameter name for cloned symbol in build manager #3140

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
scabug opened this issue Mar 4, 2010 · 6 comments
Closed

invalid change of parameter name for cloned symbol in build manager #3140

scabug opened this issue Mar 4, 2010 · 6 comments
Assignees

Comments

@scabug
Copy link

scabug commented Mar 4, 2010

I've already spent some time on this ticket, but I am creating it so that it doesn't get forgotten.
Code

class As {
  trait A {
      def foo(parents: String): A = {
        (() => parents)
        null
    }
  }
}

detects (wrongly) a change in definition of method foo (parents$$1 changed to parents). For some reason a cloned symbol of trait As$$A gets changed when we try to compile again with RefinedBuildManager even without making any changes to the source class.

In this case the for loop is the source of anonymous class and since parents is used in the body of for, therefore it gets renamed to parents$$1 in lambdalift, but the point is that this shouldn't affect the symbol that is cloned at the end of build manager process.

This is a reduced example of what I believe is happening for Types trait in symtab package. It causes (a very annoying) excessive compilation.

@scabug
Copy link
Author

scabug commented Mar 4, 2010

Imported From: https://issues.scala-lang.org/browse/SI-3140?orig=1
Reporter: @hubertp

@scabug
Copy link
Author

scabug commented Mar 4, 2010

@hubertp said:
Another thing is that if outer class As is removed, or trait A becomes a class, then the problem disappears.

@scabug
Copy link
Author

scabug commented Mar 4, 2010

@lrytz said:
Here's a wild guess, but maybe it's related to lines 149-157 in !LambdaLift.scala [http://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/compiler/scala/tools/nsc/transform/LambdaLift.scala#L149]

Lukas

@scabug
Copy link
Author

scabug commented Mar 4, 2010

@hubertp said:
Yes, that's very possible. Thanks for the pointer!

@scabug
Copy link
Author

scabug commented Mar 4, 2010

@lrytz said:
Replying to [comment:5 plocinic]:

Yes, that's very possible. Thanks for the pointer!

Note: Given an tree @ DefDef(..., vparamss, ...), you cannot generally assume that the symbols

vparamss map (_.map(_.symbol))

and

tree.tpe.paramss

are the same or have the same names. The same is true for type parameters, there it's actually implemented more systematically (using the infamous "skolems").

@scabug
Copy link
Author

scabug commented Feb 13, 2011

@hubertp said:
(In r24277) Closes #3140, #4245. no review

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