Skip to content
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

ValDef tree for field no longer carries modifiers (only tracked by symbol) #10009

Closed
scabug opened this issue Oct 26, 2016 · 4 comments
Closed

ValDef tree for field no longer carries modifiers (only tracked by symbol) #10009

scabug opened this issue Oct 26, 2016 · 4 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Oct 26, 2016

Reported in https://groups.google.com/d/msg/scala-internals/35uGsuIEnDQ/cj6AtfbfBAAJ

this is a regression due to #5141. Before, derived trees for valdefs would be rewritten to have their modifiers reflect that the underlying field is private[this]. After the fields rewrite, this is only done for the modifiers tracked by the tree's symbol. When you call untypecheck, the tree's symbol is dropped and thus it forgets that it's supposed to be private[this].

Logged a ticket to be fixed for 2.12.1.

@scabug
Copy link
Author

@scabug scabug commented Oct 26, 2016

Imported From: https://issues.scala-lang.org/browse/SI-10009?orig=1
Reporter: @adriaanm
Affected Versions: 2.12.0

@scabug
Copy link
Author

@scabug scabug commented Oct 26, 2016

@retronym said:
This affects regular typechecking, not just macros.

class C {
  def c(a: Any, b: Any*) = a
}
object Test {
  new C().c(b = new { val x = 42 }, a = 0)
}
⚡ ~/scala/2.12.0-RC1/bin/scalac sandbox/test.scala
sandbox/test.scala:5: error: x is already defined as value x
  new C().c(b = new { val x = 42 }, a = 0)
                          ^
@scabug
Copy link
Author

@scabug scabug commented Nov 9, 2016

@jvican said:
I've also encountered this misbehaviour when porting spores to 2.12. I'm generating new parameters for classes and then untypechecking, as described in https://groups.google.com/forum/#!msg/scala-internals/35uGsuIEnDQ/cj6AtfbfBAAJ. Looking forward to a fix.

@scabug
Copy link
Author

@scabug scabug commented Nov 23, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.