diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2015-05-04 16:09:19 +0200 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2015-05-04 17:20:31 +0200 |
commit | e8f32243cf25656f1ffc751d48bb792f73219e95 (patch) | |
tree | 8b1dc64a5a3d8daa9a9bd5b046d366ce2933a54d /tests/pos | |
parent | c3a7f461cd8e9a2f6c69ff85745da7892d0aa124 (diff) | |
download | dotty-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 'tests/pos')
-rw-r--r-- | tests/pos/valueclasses/t9298/JUse.java | 7 | ||||
-rw-r--r-- | tests/pos/valueclasses/t9298/Meter.scala | 3 | ||||
-rw-r--r-- | tests/pos/valueclasses/t9298/Use.scala | 9 |
3 files changed, 19 insertions, 0 deletions
diff --git a/tests/pos/valueclasses/t9298/JUse.java b/tests/pos/valueclasses/t9298/JUse.java new file mode 100644 index 000000000..a872c895a --- /dev/null +++ b/tests/pos/valueclasses/t9298/JUse.java @@ -0,0 +1,7 @@ +package t9298; + +class JUse { + public static Meter jm() { + return new Meter(2); + } +} diff --git a/tests/pos/valueclasses/t9298/Meter.scala b/tests/pos/valueclasses/t9298/Meter.scala new file mode 100644 index 000000000..290b28509 --- /dev/null +++ b/tests/pos/valueclasses/t9298/Meter.scala @@ -0,0 +1,3 @@ +package t9298 + +class Meter(val x: Int) extends AnyVal diff --git a/tests/pos/valueclasses/t9298/Use.scala b/tests/pos/valueclasses/t9298/Use.scala new file mode 100644 index 000000000..41f1fb035 --- /dev/null +++ b/tests/pos/valueclasses/t9298/Use.scala @@ -0,0 +1,9 @@ +// TODO: this should be a run test once we have run tests + +package t9298 + +object Use { + def main(args: Array[String]): Unit = { + val x: Meter = JUse.jm + } +} |