diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-09-30 08:09:01 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-09-30 08:09:01 +0200 |
commit | c0ceffb865ff4b2146aacec547cc42bb7605ee93 (patch) | |
tree | a9deedeb96ec09780de1870e1cfd7ed13e5e6e8c /test | |
parent | 344151f17b04bf75d6ebafec6aa4229dfe6cbf09 (diff) | |
parent | a026fd5e08d32d25e44add76384f823d35183c4f (diff) | |
download | scala-c0ceffb865ff4b2146aacec547cc42bb7605ee93.tar.gz scala-c0ceffb865ff4b2146aacec547cc42bb7605ee93.tar.bz2 scala-c0ceffb865ff4b2146aacec547cc42bb7605ee93.zip |
Merge pull request #4012 from retronym/merge/2.11.x-to-2.12.x-20140930
Merge 2.11.x to 2.12.x
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/macro-invalidret.check | 3 | ||||
-rw-r--r-- | test/files/neg/macro-invalidret/Impls_1.scala | 2 | ||||
-rw-r--r-- | test/files/pos/five-dot-f.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t8719.check | 0 | ||||
-rw-r--r-- | test/files/pos/t8719/Macros_1.scala | 21 | ||||
-rw-r--r-- | test/files/pos/t8719/Test_2.scala | 10 | ||||
-rw-r--r-- | test/files/pos/t8844.scala | 4 | ||||
-rw-r--r-- | test/files/presentation/t8459.check | 14 | ||||
-rw-r--r-- | test/files/presentation/t8459/Test.scala | 3 | ||||
-rw-r--r-- | test/files/presentation/t8459/src/IncompleteDynamicSelect.scala | 14 | ||||
-rw-r--r-- | test/files/run/t5530.flags | 1 | ||||
-rw-r--r-- | test/files/run/t5532.flags | 1 | ||||
-rw-r--r-- | test/files/run/t5614.flags | 1 | ||||
-rw-r--r-- | test/files/run/t8852a.scala | 34 | ||||
-rw-r--r-- | test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala | 1 |
15 files changed, 102 insertions, 8 deletions
diff --git a/test/files/neg/macro-invalidret.check b/test/files/neg/macro-invalidret.check index 568cc7c570..ebdc8ec7da 100644 --- a/test/files/neg/macro-invalidret.check +++ b/test/files/neg/macro-invalidret.check @@ -19,8 +19,7 @@ Macros_Test_2.scala:7: warning: macro defs must have explicitly specified return def foo6 = macro Impls.foo6 ^ Macros_Test_2.scala:14: error: exception during macro expansion: -scala.NotImplementedError: an implementation is missing - at scala.Predef$.$qmark$qmark$qmark(Predef.scala:225) +java.lang.NullPointerException at Impls$.foo3(Impls_1.scala:7) foo3 diff --git a/test/files/neg/macro-invalidret/Impls_1.scala b/test/files/neg/macro-invalidret/Impls_1.scala index 434aeef10f..a52e8d8f39 100644 --- a/test/files/neg/macro-invalidret/Impls_1.scala +++ b/test/files/neg/macro-invalidret/Impls_1.scala @@ -4,7 +4,7 @@ import scala.reflect.runtime.{universe => ru} object Impls { def foo1(c: Context) = 2 def foo2(c: Context) = ru.Literal(ru.Constant(42)) - def foo3(c: Context) = ??? + def foo3(c: Context) = throw null def foo5(c: Context) = c.universe.Literal(c.universe.Constant(42)) def foo6(c: Context) = c.Expr[Int](c.universe.Literal(c.universe.Constant(42))) } diff --git a/test/files/pos/five-dot-f.flags b/test/files/pos/five-dot-f.flags deleted file mode 100644 index 112fc720a0..0000000000 --- a/test/files/pos/five-dot-f.flags +++ /dev/null @@ -1 +0,0 @@ --Xfuture
\ No newline at end of file diff --git a/test/files/pos/t8719.check b/test/files/pos/t8719.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/pos/t8719.check diff --git a/test/files/pos/t8719/Macros_1.scala b/test/files/pos/t8719/Macros_1.scala new file mode 100644 index 0000000000..152c92f254 --- /dev/null +++ b/test/files/pos/t8719/Macros_1.scala @@ -0,0 +1,21 @@ +import scala.language.experimental.macros +import scala.reflect.macros.TypecheckException +import scala.reflect.macros.whitebox.Context + +object Macros { + def typecheck_impl(c: Context)(code: c.Expr[String]): c.Expr[Option[String]] = { + import c.universe._ + + val Expr(Literal(Constant(codeStr: String))) = code + + try { + c.typecheck(c.parse(codeStr)) + c.Expr(q"None: Option[String]") + } catch { + case e: TypecheckException => + c.Expr(q"Some(${ e.toString }): Option[String]") + } + } + + def typecheck(code: String): Option[String] = macro typecheck_impl +}
\ No newline at end of file diff --git a/test/files/pos/t8719/Test_2.scala b/test/files/pos/t8719/Test_2.scala new file mode 100644 index 0000000000..997eb2f236 --- /dev/null +++ b/test/files/pos/t8719/Test_2.scala @@ -0,0 +1,10 @@ +case class Foo(i: Int, c: Char) + +object Bar { + def unapply(foo: Foo): Option[(Int, Char)] = Some((foo.i, foo.c)) +} + +object Test extends App { + println(Macros.typecheck("val Foo(x, y, z) = Foo(1, 'a')")) + println(Macros.typecheck("val Bar(x, y, z) = Foo(1, 'a')")) +}
\ No newline at end of file diff --git a/test/files/pos/t8844.scala b/test/files/pos/t8844.scala new file mode 100644 index 0000000000..d33c520d1b --- /dev/null +++ b/test/files/pos/t8844.scala @@ -0,0 +1,4 @@ +object Example { + type S[A] = String + def foo(s: S[_]): String = s +} diff --git a/test/files/presentation/t8459.check b/test/files/presentation/t8459.check new file mode 100644 index 0000000000..336c147141 --- /dev/null +++ b/test/files/presentation/t8459.check @@ -0,0 +1,14 @@ +reload: IncompleteDynamicSelect.scala + +askType at IncompleteDynamicSelect.scala(12,2) +================================================================================ +[response] askTypeAt (12,2) +scala.AnyRef { + def <init>(): Foo = { + Foo.super.<init>(); + () + }; + private[this] val bar: F = new F(); + Foo.this.bar.<selectDynamic: error>("<error>") +} +================================================================================ diff --git a/test/files/presentation/t8459/Test.scala b/test/files/presentation/t8459/Test.scala new file mode 100644 index 0000000000..bec1131c4c --- /dev/null +++ b/test/files/presentation/t8459/Test.scala @@ -0,0 +1,3 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest + +object Test extends InteractiveTest
\ No newline at end of file diff --git a/test/files/presentation/t8459/src/IncompleteDynamicSelect.scala b/test/files/presentation/t8459/src/IncompleteDynamicSelect.scala new file mode 100644 index 0000000000..61976fe2f9 --- /dev/null +++ b/test/files/presentation/t8459/src/IncompleteDynamicSelect.scala @@ -0,0 +1,14 @@ +import scala.language.dynamics + +class F extends Dynamic { + def applyDynamic(name: String)(args: Any*) = + s"method '$name' called with arguments ${args.mkString("'", "', '", "'")}" +} + +class Foo { + val bar = new F + + bar. //note whitespace after dot + /*?*/ //force typechecking +} + diff --git a/test/files/run/t5530.flags b/test/files/run/t5530.flags deleted file mode 100644 index e1b37447c9..0000000000 --- a/test/files/run/t5530.flags +++ /dev/null @@ -1 +0,0 @@ --Xexperimental
\ No newline at end of file diff --git a/test/files/run/t5532.flags b/test/files/run/t5532.flags deleted file mode 100644 index e1b37447c9..0000000000 --- a/test/files/run/t5532.flags +++ /dev/null @@ -1 +0,0 @@ --Xexperimental
\ No newline at end of file diff --git a/test/files/run/t5614.flags b/test/files/run/t5614.flags deleted file mode 100644 index 48fd867160..0000000000 --- a/test/files/run/t5614.flags +++ /dev/null @@ -1 +0,0 @@ --Xexperimental diff --git a/test/files/run/t8852a.scala b/test/files/run/t8852a.scala new file mode 100644 index 0000000000..cbff8ab75b --- /dev/null +++ b/test/files/run/t8852a.scala @@ -0,0 +1,34 @@ +import scala.tools.partest._ + +// Test that static methods in Java interfaces (new in Java 8) +// are callable from jointly compiler Scala code. +object Test extends CompilerTest { + import global._ + + override lazy val units: List[CompilationUnit] = { + // This test itself does not depend on JDK8. + javaCompilationUnits(global)(staticMethodInInterface) ++ + compilationUnits(global)(scalaClient) + } + + private def staticMethodInInterface = """ +public interface Interface { + public static int staticMethod() { + return 42; + } +} + + """ + + private def scalaClient = """ +object Test { + val x: Int = Interface.staticMethod() +} + +class C extends Interface // expect no errors about unimplemented members. + + """ + + // We're only checking we can compile it. + def check(source: String, unit: global.CompilationUnit): Unit = () +} diff --git a/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala b/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala index 91868a5683..e4be42ac96 100644 --- a/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala +++ b/test/junit/scala/tools/nsc/symtab/SymbolTableForUnitTesting.scala @@ -33,7 +33,6 @@ class SymbolTableForUnitTesting extends SymbolTable { lazy val loaders: SymbolTableForUnitTesting.this.loaders.type = SymbolTableForUnitTesting.this.loaders def platformPhases: List[SubComponent] = Nil val classPath: ClassPath[AbstractFile] = new PathResolver(settings).result - def doLoad(cls: ClassPath[AbstractFile]#ClassRep): Boolean = true def isMaybeBoxed(sym: Symbol): Boolean = ??? def needCompile(bin: AbstractFile, src: AbstractFile): Boolean = ??? def externalEquals: Symbol = ??? |