summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-03-05 13:59:07 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-03-05 17:11:37 +1000
commit5471f011f85fef82cbe8bebb0c5f91b980031c5f (patch)
treea7b0cc30870eeb3ef2ecf8086f87a4a63fd8f39a /src
parentd30098c30de94e6ec07b5c8b6782357183e24179 (diff)
downloadscala-5471f011f85fef82cbe8bebb0c5f91b980031c5f.tar.gz
scala-5471f011f85fef82cbe8bebb0c5f91b980031c5f.tar.bz2
scala-5471f011f85fef82cbe8bebb0c5f91b980031c5f.zip
SI-9200 Fix Java generic signatures for refined types
The erasure of a refined type `T1 with T2 ... Tn` is the erasure of the intersection dominator of the elements. In addition to erased method signatures, the compiler also emits Java generic signatures, included information about generic types, up to the point that it is possible to express in the language of Java 5 generics. Java generic signatures must be consistent with erasued signatures, that is, the Java compiler must erase that generic signature to the same erased signature. If this does not hold, linkage errors will occur. The compiler implements erasure in `ErasureMap` and java generic signatures in `Erasure#javaSig`. Regrettably, these don't share any implementation; e.g `javaSig` only takes the first parent of a refinement type, rather than using `intersectionDominator`. This commit fixes that discrepency.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index 5c72bb3258..f686df60fd 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -339,8 +339,8 @@ abstract class Erasure extends AddInterfaces
buf append (if (restpe.typeSymbol == UnitClass || sym0.isConstructor) VOID_TAG.toString else jsig(restpe))
buf.toString
- case RefinedType(parent :: _, decls) =>
- boxedSig(parent)
+ case RefinedType(parents, decls) =>
+ boxedSig(intersectionDominator(parents))
case ClassInfoType(parents, _, _) =>
superSig(parents)
case AnnotatedType(_, atp) =>