diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2015-07-27 13:31:32 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2015-07-27 13:31:32 +1000 |
commit | f2d7838d904572b3dd15a9ef223ecfd1a6e14697 (patch) | |
tree | 20d04ea95d60d936f0e48c9767e50e869704d68a /test/files | |
parent | 4c6dcfe9341d2db47a0b0a567f5646fb9d573020 (diff) | |
parent | 241bb9ac192f13868436d9a4e2e7ae29a2e22bed (diff) | |
download | scala-f2d7838d904572b3dd15a9ef223ecfd1a6e14697.tar.gz scala-f2d7838d904572b3dd15a9ef223ecfd1a6e14697.tar.bz2 scala-f2d7838d904572b3dd15a9ef223ecfd1a6e14697.zip |
Merge pull request #4657 from lrytz/backports
backports from 2.12.x
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/jvm/innerClassAttribute/Test.scala | 4 | ||||
-rw-r--r-- | test/files/neg/t6013/Base.java | 2 | ||||
-rw-r--r-- | test/files/pos/t9392/client_2.scala | 4 | ||||
-rw-r--r-- | test/files/pos/t9392/macro_1.scala | 16 | ||||
-rw-r--r-- | test/files/pos/t9393/NamedImpl_1.java | 15 | ||||
-rw-r--r-- | test/files/pos/t9393/NamedImpl_2.java | 15 | ||||
-rw-r--r-- | test/files/pos/t9393/Named_1.java | 3 | ||||
-rw-r--r-- | test/files/pos/t9393/Named_2.java | 3 | ||||
-rw-r--r-- | test/files/pos/t9393/test_2.scala | 4 | ||||
-rw-r--r-- | test/files/run/scalapInvokedynamic.check | 5 | ||||
-rw-r--r-- | test/files/run/scalapInvokedynamic.scala | 11 | ||||
-rw-r--r-- | test/files/run/t9387.scala | 20 | ||||
-rw-r--r-- | test/files/run/t9387b.check | 1 | ||||
-rw-r--r-- | test/files/run/t9387b.scala | 16 |
14 files changed, 115 insertions, 4 deletions
diff --git a/test/files/jvm/innerClassAttribute/Test.scala b/test/files/jvm/innerClassAttribute/Test.scala index 376b3c895b..3a6737ca46 100644 --- a/test/files/jvm/innerClassAttribute/Test.scala +++ b/test/files/jvm/innerClassAttribute/Test.scala @@ -149,9 +149,7 @@ object Test extends BytecodeTest { def testA11() = { val List(ann) = innerClassNodes("A11") - // in the java class file, the INNERCLASS attribute has more flags (public | static | abstract | interface | annotation) - // the scala compiler has its own interpretation of java annotations ant their flags.. it only emits publicStatic. - assertMember(ann, "JavaAnnot_1", "Ann", flags = publicStatic) + assertMember(ann, "JavaAnnot_1", "Ann", flags = publicAbstractInterface | Flags.ACC_STATIC | Flags.ACC_ANNOTATION) } def testA13() = { diff --git a/test/files/neg/t6013/Base.java b/test/files/neg/t6013/Base.java index b73d7fd821..ce6ee47e64 100644 --- a/test/files/neg/t6013/Base.java +++ b/test/files/neg/t6013/Base.java @@ -2,7 +2,7 @@ abstract public class Base { // This must considered to be overridden by Abstract#foo based // on the erased signatures. This special case is handled by // `javaErasedOverridingSym` in `RefChecks`. - public abstract void bar(java.util.List<java.lang.String> foo) { return; } + public void bar(java.util.List<java.lang.String> foo) { return; } // But, a concrete method in a Java superclass must not excuse // a deferred method in the Java subclass! diff --git a/test/files/pos/t9392/client_2.scala b/test/files/pos/t9392/client_2.scala new file mode 100644 index 0000000000..6b706fea12 --- /dev/null +++ b/test/files/pos/t9392/client_2.scala @@ -0,0 +1,4 @@ +class Client { + Macro() +} + diff --git a/test/files/pos/t9392/macro_1.scala b/test/files/pos/t9392/macro_1.scala new file mode 100644 index 0000000000..3f67ac17b2 --- /dev/null +++ b/test/files/pos/t9392/macro_1.scala @@ -0,0 +1,16 @@ +import language.experimental.macros + + +object Macro { + + import reflect.macros.blackbox.Context + def impl(c: Context)(): c.Tree = { + import c.universe._ + val tree = q"""class C; new C""" + val tree1 = c.typecheck(tree) + val tpe = tree1.tpe + val tree2 = c.typecheck(c.untypecheck(tree1)) + q"""$tree2.asInstanceOf[$tpe]""" + } + def apply(): Any = macro impl +} diff --git a/test/files/pos/t9393/NamedImpl_1.java b/test/files/pos/t9393/NamedImpl_1.java new file mode 100644 index 0000000000..02ec9b4671 --- /dev/null +++ b/test/files/pos/t9393/NamedImpl_1.java @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> + */ +package bug; + +import bug.Named_1; +import java.io.Serializable; +import java.lang.annotation.Annotation; + +public class NamedImpl_1 implements Named_1 { + + public Class<? extends Annotation> annotationType() { + return null; + } +} diff --git a/test/files/pos/t9393/NamedImpl_2.java b/test/files/pos/t9393/NamedImpl_2.java new file mode 100644 index 0000000000..c87e94016d --- /dev/null +++ b/test/files/pos/t9393/NamedImpl_2.java @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> + */ +package bug; + +import bug.Named_2; +import java.io.Serializable; +import java.lang.annotation.Annotation; + +public class NamedImpl_2 implements Named_2 { + + public Class<? extends Annotation> annotationType() { + return null; + } +} diff --git a/test/files/pos/t9393/Named_1.java b/test/files/pos/t9393/Named_1.java new file mode 100644 index 0000000000..30a6c9839a --- /dev/null +++ b/test/files/pos/t9393/Named_1.java @@ -0,0 +1,3 @@ +package bug; + +public @interface Named_1 {} diff --git a/test/files/pos/t9393/Named_2.java b/test/files/pos/t9393/Named_2.java new file mode 100644 index 0000000000..3210fb636a --- /dev/null +++ b/test/files/pos/t9393/Named_2.java @@ -0,0 +1,3 @@ +package bug; + +public @interface Named_2 {} diff --git a/test/files/pos/t9393/test_2.scala b/test/files/pos/t9393/test_2.scala new file mode 100644 index 0000000000..8ea346129d --- /dev/null +++ b/test/files/pos/t9393/test_2.scala @@ -0,0 +1,4 @@ +class C { + new bug.NamedImpl_1 // separate compilation, testing the classfile parser + new bug.NamedImpl_2 // mixed compilation, testing the java source parser +} diff --git a/test/files/run/scalapInvokedynamic.check b/test/files/run/scalapInvokedynamic.check new file mode 100644 index 0000000000..8e4b08f234 --- /dev/null +++ b/test/files/run/scalapInvokedynamic.check @@ -0,0 +1,5 @@ +class C extends scala.AnyRef { + def this() = { /* compiled code */ } + def m: java.lang.String = { /* compiled code */ } +} + diff --git a/test/files/run/scalapInvokedynamic.scala b/test/files/run/scalapInvokedynamic.scala new file mode 100644 index 0000000000..670cf26662 --- /dev/null +++ b/test/files/run/scalapInvokedynamic.scala @@ -0,0 +1,11 @@ +class C { + def m = { + val f = (x: String) => x.trim + f(" H ae i ") + } +} + +object Test extends App { + val testClassesDir = System.getProperty("partest.output") + scala.tools.scalap.Main.main(Array("-cp", testClassesDir, "C")) +}
\ No newline at end of file diff --git a/test/files/run/t9387.scala b/test/files/run/t9387.scala new file mode 100644 index 0000000000..3e33d19fd2 --- /dev/null +++ b/test/files/run/t9387.scala @@ -0,0 +1,20 @@ +class G[T] +object G { + def v[T](x: T): G[T] = null +} + +class A[T] +object A { + def apply[T](x: => G[T]): A[T] = null +} + +object T { + A[Unit](G.v(() => ())) // Was VerifyError +} + +object Test { + def main(args: Array[String]): Unit = { + T + } + +}
\ No newline at end of file diff --git a/test/files/run/t9387b.check b/test/files/run/t9387b.check new file mode 100644 index 0000000000..6a452c185a --- /dev/null +++ b/test/files/run/t9387b.check @@ -0,0 +1 @@ +() diff --git a/test/files/run/t9387b.scala b/test/files/run/t9387b.scala new file mode 100644 index 0000000000..6339f4caba --- /dev/null +++ b/test/files/run/t9387b.scala @@ -0,0 +1,16 @@ +object T { + val f: Unit = () => () + println(f) +} + +object U { + def f[T](t: T): T = t + f[Unit](() => ()) +} + +object Test { + def main(args: Array[String]): Unit = { + T + U + } +} |