diff options
author | Adriaan Moors <adriaan@lightbend.com> | 2016-12-19 14:39:46 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-19 14:39:46 -0800 |
commit | bba42ff5d410127c8fd9be0073a6eda91b8029d1 (patch) | |
tree | 5b441552f074ee574c54bb32dc04b509e1e72d5b /test | |
parent | a9802c317a72925838bcd5c53a5919f75b577caa (diff) | |
parent | 14451a9c910908fb0c39cf20ad6a5bcb6d65a41c (diff) | |
download | scala-bba42ff5d410127c8fd9be0073a6eda91b8029d1.tar.gz scala-bba42ff5d410127c8fd9be0073a6eda91b8029d1.tar.bz2 scala-bba42ff5d410127c8fd9be0073a6eda91b8029d1.zip |
Merge pull request #5541 from retronym/ticket/10067
SI-10067 Avoid linkage errors with type patterns, Java inner classes
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t10067.flags | 1 | ||||
-rw-r--r-- | test/files/run/t10067/OuterClass.java | 7 | ||||
-rw-r--r-- | test/files/run/t10067/Test.scala | 19 |
3 files changed, 27 insertions, 0 deletions
diff --git a/test/files/run/t10067.flags b/test/files/run/t10067.flags new file mode 100644 index 0000000000..c02e5f2461 --- /dev/null +++ b/test/files/run/t10067.flags @@ -0,0 +1 @@ +-unchecked diff --git a/test/files/run/t10067/OuterClass.java b/test/files/run/t10067/OuterClass.java new file mode 100644 index 0000000000..15c2c990d7 --- /dev/null +++ b/test/files/run/t10067/OuterClass.java @@ -0,0 +1,7 @@ +public class OuterClass { + public class InnerClass { } + + public Object getInnerClassInstance() { + return new InnerClass(); + } +} diff --git a/test/files/run/t10067/Test.scala b/test/files/run/t10067/Test.scala new file mode 100644 index 0000000000..af1e12592e --- /dev/null +++ b/test/files/run/t10067/Test.scala @@ -0,0 +1,19 @@ +object Test { + def main(args: Array[String]): Unit = { + //get inner class as some instance of super type + var oc = new OuterClass(); + var icObj = oc.getInnerClassInstance(); + + //get a stable identifier on outer class + val ocStable = oc; + + //these will work + icObj.isInstanceOf[ocStable.InnerClass]; + icObj.asInstanceOf[ocStable.InnerClass]; + + //this will fail with java.lang.NoSuchMethodError + icObj match { + case ic: ocStable.InnerClass => ; + } + } +} |