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

Specialization's duplicator loses annotations #7579

Open
scabug opened this issue Jun 14, 2013 · 5 comments
Open

Specialization's duplicator loses annotations #7579

scabug opened this issue Jun 14, 2013 · 5 comments

Comments

@scabug
Copy link

@scabug scabug commented Jun 14, 2013

$ cat Z.scala 
object Test {
  class myAnnotation extends scala.annotation.StaticAnnotation
  def dontForgetTheAnnotation_![@specialized(Int) X](x: X) = {
    @myAnnotation val y = 3
  }
}

$ scalac Z.scala -Xprint:spec
[[syntax trees at end of                specialize]] // Z.scala
package <empty> {
  object Test extends Object {
    ...
    def dontForgetTheAnnotation_![@specialized(scala.Int) X >: Nothing <: Any](x: X): Unit = {
      @Test.myAnnotation val y: Int = 3;
      ()
    };
    <specialized> def dontForgetTheAnnotation_!$mIc$sp(x: Int): Unit = {
      val y: Int = 3; // @Test.annotation was lost during duplication
      ()
    }
  }
}

This prevents a full fix for #7344.

@scabug
Copy link
Author

@scabug scabug commented Jun 14, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7579?orig=1
Reporter: @VladUreche
Affected Versions: 2.10.2-RC2

@scabug
Copy link
Author

@scabug scabug commented Jun 14, 2013

@VladUreche said:
Note to self: don't forget to enable the test case for #7344 when this is fixed.

@scabug
Copy link
Author

@scabug scabug commented Jun 24, 2013

@dragos said:
Another reason to stop removing annotations from the AST (the annotations are moved to the corresponding symbol during type-checking)...

@scabug
Copy link
Author

@scabug scabug commented Jun 24, 2013

@VladUreche said:
I agree it's annoying to copy annotations over in Duplicators, but having them attached to symbols makes any annotation change much easier, as there's no need to update the tree. So I guess it's Duplicators that should adapt, not the other way around.

On the other hand, I should really look into this, copying over annotations using the invalidSyms map only copied the annotations to skolems instead of the original type params, so there may be deeper bugs that need to be addressed. Or maybe it should only track skolems?

@scabug
Copy link
Author

@scabug scabug commented May 17, 2014

@VladUreche said:
Fixed in miniboxing => miniboxing/miniboxing-plugin@e6c92bb

In case there's serious interest in this bug, I can port it to scalac (right now, only Iuli and me are watching it...)

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

Successfully merging a pull request may close this issue.

None yet
3 participants