diff options
author | Vlad Ureche <vlad.ureche@gmail.com> | 2013-06-12 14:58:09 +0200 |
---|---|---|
committer | Vlad Ureche <vlad.ureche@gmail.com> | 2013-06-12 19:34:33 +0200 |
commit | c43b504ac1d843a580683a78eca0cb55bb427c15 (patch) | |
tree | 1f39bc2d0a760c6bee8fd92d6b95e6f2b97e51c8 /test/files/specialized/spec-ame.scala | |
parent | c0ba5eb196cc3c7174c9278dd4d050513e55b4ce (diff) | |
download | scala-c43b504ac1d843a580683a78eca0cb55bb427c15.tar.gz scala-c43b504ac1d843a580683a78eca0cb55bb427c15.tar.bz2 scala-c43b504ac1d843a580683a78eca0cb55bb427c15.zip |
SI-7343 Fixed phase ordering in specialization
Specialization rewires class parents during info transformation, and
the new info then guides the tree changes. But if a symbol is created
during duplication, which runs after specialization, its info is not
visited and thus the corresponding tree is not specialized.
One manifestation is the following:
```
object Test {
class Parent[@specialized(Int) T]
def spec_method[@specialized(Int) T](t: T, expectedXSuper: String) = {
class X extends Parent[T]()
// even in the specialized variant, the local X class
// doesn't extend Parent$mcI$sp, since its symbol has
// been created after specialization and was not seen
// by specialzation's info transformer.
...
}
}
```
We can fix this by forcing duplication to take place before specialization.
Review by @dragos, @paulp or @axel22.
Diffstat (limited to 'test/files/specialized/spec-ame.scala')
-rw-r--r-- | test/files/specialized/spec-ame.scala | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/files/specialized/spec-ame.scala b/test/files/specialized/spec-ame.scala index 79ee4217ed..129fb9f447 100644 --- a/test/files/specialized/spec-ame.scala +++ b/test/files/specialized/spec-ame.scala @@ -13,6 +13,9 @@ object Test { def main(args: Array[String]) { println((new A("abc")).foo.value) println((new A(10)).foo.value) + // before fixing SI-7343, this was printing 3. Now it's printing 2, + // since the anonymous class created by doing new B[T] { ... } when + // T = Int is now rewired to B$mcI$sp instead of just B[Int] println(runtime.BoxesRunTime.integerBoxCount) } } |