diff options
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/classfile-format-51.scala | 2 | ||||
-rw-r--r-- | test/files/run/classfile-format-52.scala | 2 | ||||
-rw-r--r-- | test/files/run/t7741a/Test.scala | 2 | ||||
-rw-r--r-- | test/files/run/t9268.check | 5 | ||||
-rw-r--r-- | test/files/run/t9268/Java.java | 12 | ||||
-rw-r--r-- | test/files/run/t9268/Test.scala | 40 | ||||
-rw-r--r-- | test/files/run/valueClassSelfType.scala | 52 |
7 files changed, 112 insertions, 3 deletions
diff --git a/test/files/run/classfile-format-51.scala b/test/files/run/classfile-format-51.scala index 4351757a64..da322bb5d9 100644 --- a/test/files/run/classfile-format-51.scala +++ b/test/files/run/classfile-format-51.scala @@ -11,7 +11,7 @@ import Opcodes._ // it runs a normal compile on the source in the 'code' field that refers to // DynamicInvoker. Any failure will be dumped to std out. // -// By it's nature the test can only work on JDK 7+ because under JDK 6 some of the +// By its nature the test can only work on JDK 7+ because under JDK 6 some of the // classes referred to by DynamicInvoker won't be available and DynamicInvoker won't // verify. So the test includes a version check that short-circuites the whole test // on JDK 6 diff --git a/test/files/run/classfile-format-52.scala b/test/files/run/classfile-format-52.scala index 6646e081c4..e278d40b8b 100644 --- a/test/files/run/classfile-format-52.scala +++ b/test/files/run/classfile-format-52.scala @@ -10,7 +10,7 @@ import Opcodes._ // HasDefaultMethod. Then it runs a normal compile on Scala source that extends that // interface. Any failure will be dumped to std out. // -// By it's nature the test can only work on JDK 8+ because under JDK 7- the +// By its nature the test can only work on JDK 8+ because under JDK 7- the // interface won't verify. object Test extends DirectTest { override def extraSettings: String = "-optimise -usejavacp -d " + testOutput.path + " -cp " + testOutput.path diff --git a/test/files/run/t7741a/Test.scala b/test/files/run/t7741a/Test.scala index a75cb6c9eb..cdba1cccf8 100644 --- a/test/files/run/t7741a/Test.scala +++ b/test/files/run/t7741a/Test.scala @@ -25,7 +25,7 @@ object Test extends DirectTest { // interface GroovyInterface { // // // This is the line that causes scalac to choke. - // // It results in a GroovyInterface$1 class, which is a non-static inner class but it's constructor does not + // // It results in a GroovyInterface$1 class, which is a non-static inner class but its constructor does not // // include the implicit parameter that is the immediate enclosing instance. // // See http://jira.codehaus.org/browse/GROOVY-7312 // // diff --git a/test/files/run/t9268.check b/test/files/run/t9268.check new file mode 100644 index 0000000000..90ef940eb3 --- /dev/null +++ b/test/files/run/t9268.check @@ -0,0 +1,5 @@ +Compiling Client1 +pos: NoPosition Class Waiter not found - continuing with a stub. WARNING +Compiling Client2 +pos: NoPosition Class Waiter not found - continuing with a stub. WARNING +pos: NoPosition Unable to locate class corresponding to inner class entry for Predicate in owner Waiter ERROR diff --git a/test/files/run/t9268/Java.java b/test/files/run/t9268/Java.java new file mode 100644 index 0000000000..c9a0bec3ff --- /dev/null +++ b/test/files/run/t9268/Java.java @@ -0,0 +1,12 @@ +public class Java { +} + +class Partial { + public <E extends java.lang.Exception> long waitFor(long l, Waiter.Predicate<E> pred) throws E { + return 0L; + } +} + +class Waiter { + interface Predicate<E> {} +} diff --git a/test/files/run/t9268/Test.scala b/test/files/run/t9268/Test.scala new file mode 100644 index 0000000000..813cbe7b60 --- /dev/null +++ b/test/files/run/t9268/Test.scala @@ -0,0 +1,40 @@ +import scala.tools.partest._ +import java.io.File + +object Test extends StoreReporterDirectTest { + def code = ??? + + def compileCode(code: String) = { + val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") + compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code) + } + + def client1 = """ + class Client1 { def p(p: Partial) = p.toString } + """ + + def client2 = """ + class Client2 { def p(p: Partial) = p.waitFor() } + """ + + def deleteClass(s: String) = { + val f = new File(testOutput.path, s + ".class") + assert(f.exists) + f.delete() + } + + def show(): Unit = { + deleteClass("Waiter") + deleteClass("Waiter$Predicate") + + // Used to crash in Java Generic Signature parsing + println("Compiling Client1") + compileCode(client1) + println(storeReporter.infos.mkString("\n")) + storeReporter.reset() + println("Compiling Client2") + compileCode(client2) + println(storeReporter.infos.mkString("\n")) + } +} + diff --git a/test/files/run/valueClassSelfType.scala b/test/files/run/valueClassSelfType.scala new file mode 100644 index 0000000000..47a3764b0a --- /dev/null +++ b/test/files/run/valueClassSelfType.scala @@ -0,0 +1,52 @@ +trait T + +class V1(val l: Long) extends AnyVal { self: T => + def foo: V1 = self + def bar: T = self +} + +class V2(val l: Long) extends AnyVal { self => + def foo: V2 = self +} + +class V3(val l: Long) extends AnyVal { self: Long => + def foo: V3 = self + def bar: Long = self +} + +// non-value classes + +class C1(val l: Long) { self: T => + def foo: C1 = self + def bar: T = self +} + +class C2(val l: Long) { self => + def foo: C2 = self +} + +class C3(val l: Long) { self: Long => + def foo: C3 = self + def bar: Long = self +} + +object Test extends App { + // Rejected: superclass V1 is not a subclass of the superclass Object of the mixin trait T + // new V1(1l) with T + + assert(new V2(1l).foo.l == 1l) + + // Rejected: V3 does not conform to its self-type V3 with Long + // new V3(1l) + + val c2 = new C1(2l) with T + assert(c2.foo.l + c2.bar.asInstanceOf[C1].l == 4l) + + assert(new C2(3l).foo.l == 3l) + + // Rejected: C3 does not conform to its self-type C3 with Long + // new C3(4l) + + // Rejected: class Long needs to be a trait to be mixed in + // new C3(4l) with Long +} |