aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeErasure.scala
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2015-05-04 16:09:19 +0200
committerGuillaume Martres <smarter@ubuntu.com>2015-05-04 17:20:31 +0200
commite8f32243cf25656f1ffc751d48bb792f73219e95 (patch)
tree8b1dc64a5a3d8daa9a9bd5b046d366ce2933a54d /src/dotty/tools/dotc/core/TypeErasure.scala
parentc3a7f461cd8e9a2f6c69ff85745da7892d0aa124 (diff)
downloaddotty-e8f32243cf25656f1ffc751d48bb792f73219e95.tar.gz
dotty-e8f32243cf25656f1ffc751d48bb792f73219e95.tar.bz2
dotty-e8f32243cf25656f1ffc751d48bb792f73219e95.zip
Fix compatibility of Java with value classes
This avoids getting a runtime error when calling a Java-defined method whose signature contains value classes. It happened because we erased the value classes in this signature even though it comes from a classfile. Amusingly, this problem also exists in scalac: <https://issues.scala-lang.org/browse/SI-9298>
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeErasure.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeErasure.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/TypeErasure.scala b/src/dotty/tools/dotc/core/TypeErasure.scala
index 9d5436d9f..71146bd4e 100644
--- a/src/dotty/tools/dotc/core/TypeErasure.scala
+++ b/src/dotty/tools/dotc/core/TypeErasure.scala
@@ -145,12 +145,15 @@ object TypeErasure {
* - For companion methods : the erasure of their type with semiEraseVCs = false.
* The signature of these methods are used to keep a
* link between companions and should not be semi-erased.
+ * - For Java-defined symbols: : the erasure of their type with isJava = true,
+ * semiEraseVCs = false. Semi-erasure never happens in Java.
* - For all other symbols : the semi-erasure of their types, with
* isJava, isConstructor set according to symbol.
*/
def transformInfo(sym: Symbol, tp: Type)(implicit ctx: Context): Type = {
- val semiEraseVCs = !sym.isCompanionMethod
- val erase = erasureFn(sym is JavaDefined, semiEraseVCs, sym.isConstructor, wildcardOK = false)
+ val isJava = sym is JavaDefined
+ val semiEraseVCs = !isJava && !sym.isCompanionMethod
+ val erase = erasureFn(isJava, semiEraseVCs, sym.isConstructor, wildcardOK = false)
def eraseParamBounds(tp: PolyType): Type =
tp.derivedPolyType(