diff options
Diffstat (limited to 'test/files')
33 files changed, 248 insertions, 77 deletions
diff --git a/test/files/jvm/future-spec/PromiseTests.scala b/test/files/jvm/future-spec/PromiseTests.scala index 49350586b8..12b9168c5d 100644 --- a/test/files/jvm/future-spec/PromiseTests.scala +++ b/test/files/jvm/future-spec/PromiseTests.scala @@ -38,10 +38,10 @@ class PromiseTests extends MinimalScalaTest { Await.result(failure fallbackTo timedOut, defaultTimeout) mustBe ("Timedout") Await.result(timedOut fallbackTo empty, defaultTimeout) mustBe ("Timedout") - Await.result(failure fallbackTo failure fallbackTo timedOut, defaultTimeout) mustBe ("Timedout") + Await.result(otherFailure fallbackTo failure fallbackTo timedOut, defaultTimeout) mustBe ("Timedout") intercept[RuntimeException] { Await.result(failure fallbackTo otherFailure, defaultTimeout) - }.getMessage mustBe ("last") + }.getMessage mustBe ("br0ken") } } diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala index b431f6b8f8..ce86d4aef0 100644 --- a/test/files/jvm/scala-concurrent-tck.scala +++ b/test/files/jvm/scala-concurrent-tck.scala @@ -344,8 +344,8 @@ def testTransformFailure(): Unit = once { def testFallbackToFailure(): Unit = once { done => val cause = new Exception - val f = Future { sys.error("failed") } - val g = Future { throw cause } + val f = Future { throw cause } + val g = Future { sys.error("failed") } val h = f fallbackTo g h onSuccess { case _ => done(false) } diff --git a/test/files/neg/macro-bundle-class.check b/test/files/neg/macro-bundle-class.check index 8fd04f1303..7108c15b8d 100644 --- a/test/files/neg/macro-bundle-class.check +++ b/test/files/neg/macro-bundle-class.check @@ -1,4 +1,4 @@ macro-bundle-class.scala:10: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member def foo = macro Bundle.impl - ^ + ^ one error found diff --git a/test/files/neg/macro-bundle-mixbox.check b/test/files/neg/macro-bundle-mixbox.check index 4f8cedcece..c3136d9369 100644 --- a/test/files/neg/macro-bundle-mixbox.check +++ b/test/files/neg/macro-bundle-mixbox.check @@ -1,4 +1,4 @@ macro-bundle-mixbox.scala:9: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member def foo = macro Bundle.impl - ^ + ^ one error found diff --git a/test/files/neg/macro-bundle-object.check b/test/files/neg/macro-bundle-object.check index e148e86969..293f40a178 100644 --- a/test/files/neg/macro-bundle-object.check +++ b/test/files/neg/macro-bundle-object.check @@ -1,8 +1,8 @@ -macro-bundle-object.scala:10: error: macro implementation has wrong shape: +macro-bundle-object.scala:10: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : : Nothing number of parameter sections differ def foo = macro Bundle.impl - ^ + ^ one error found diff --git a/test/files/neg/macro-bundle-polymorphic.check b/test/files/neg/macro-bundle-polymorphic.check index 07c5f551b1..e024fcde93 100644 --- a/test/files/neg/macro-bundle-polymorphic.check +++ b/test/files/neg/macro-bundle-polymorphic.check @@ -1,10 +1,10 @@ macro-bundle-polymorphic.scala:9: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member def foo = macro Bundle.impl - ^ + ^ macro-bundle-polymorphic.scala:10: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member def foo = macro Bundle[Int].impl - ^ + ^ macro-bundle-polymorphic.scala:11: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member def foo = macro Bundle[Int, Nothing].impl - ^ + ^ three errors found diff --git a/test/files/neg/macro-bundle-trait.check b/test/files/neg/macro-bundle-trait.check index bf906a5310..3cb7985013 100644 --- a/test/files/neg/macro-bundle-trait.check +++ b/test/files/neg/macro-bundle-trait.check @@ -1,4 +1,4 @@ macro-bundle-trait.scala:11: error: macro bundles must be monomorphic traits extending either BlackboxMacro or WhiteboxMacro and not implementing their `val c: BlackboxContext/WhiteboxContext` member def foo = macro Bundle.impl - ^ + ^ one error found diff --git a/test/files/neg/macro-invalidimpl.check b/test/files/neg/macro-invalidimpl.check index 432da4d00b..5eff401bef 100644 --- a/test/files/neg/macro-invalidimpl.check +++ b/test/files/neg/macro-invalidimpl.check @@ -2,22 +2,22 @@ Macros_Test_2.scala:5: error: macro implementation reference has wrong shape. re macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo(x: Any) = macro impls.foo - ^ + ^ Macros_Test_2.scala:10: error: macro implementation reference has wrong shape. required: macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo(x: Any) = macro impls.foo - ^ + ^ Macros_Test_2.scala:18: error: macro implementation reference has wrong shape. required: macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo(x: Any) = macro Impls3.foo - ^ + ^ Macros_Test_2.scala:22: error: macro implementation reference has wrong shape. required: macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo(x: Any) = macro Impls4.foo - ^ + ^ Macros_Test_2.scala:26: error: ambiguous reference to overloaded definition, both method foo in object Impls5 of type (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any], y: c.Expr[Any])Nothing and method foo in object Impls5 of type (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any])Nothing @@ -30,24 +30,24 @@ and method foo in object Impls5 of type (c: scala.reflect.macros.BlackboxContex match expected type ? def foo(x: Any, y: Any) = macro Impls5.foo ^ -Macros_Test_2.scala:31: error: macro implementation has wrong shape: +Macros_Test_2.scala:31: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Unit] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(): c.Expr[Unit] number of parameter sections differ def foo1 = macro Impls6.fooEmpty - ^ -Macros_Test_2.scala:32: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:32: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext)(): c.Expr[Unit] or : (c: scala.reflect.macros.BlackboxContext)(): c.Tree found : (c: scala.reflect.macros.BlackboxContext): c.Expr[Unit] number of parameter sections differ def bar1() = macro Impls6.fooNullary - ^ + ^ Macros_Test_2.scala:36: error: type arguments [String] do not conform to method foo's type parameter bounds [U <: Int] def foo = macro Impls7.foo[String] ^ Macros_Test_2.scala:53: error: macro implementation must be public def foo = macro Impls8.impl - ^ + ^ 10 errors found diff --git a/test/files/neg/macro-invalidret.check b/test/files/neg/macro-invalidret.check index 19adc70fb3..ea003a17ec 100644 --- a/test/files/neg/macro-invalidret.check +++ b/test/files/neg/macro-invalidret.check @@ -1,15 +1,15 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape: +Macros_Test_2.scala:2: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : (c: scala.reflect.macros.BlackboxContext): Int type mismatch for return type: Int does not conform to c.Expr[Any] def foo1 = macro Impls.foo1 - ^ -Macros_Test_2.scala:3: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:3: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : (c: scala.reflect.macros.BlackboxContext): reflect.runtime.universe.Literal type mismatch for return type: reflect.runtime.universe.Literal does not conform to c.Expr[Any] def foo2 = macro Impls.foo2 - ^ + ^ two errors found diff --git a/test/files/neg/macro-invalidshape.check b/test/files/neg/macro-invalidshape.check index 1938f5ae47..aa694df6d6 100644 --- a/test/files/neg/macro-invalidshape.check +++ b/test/files/neg/macro-invalidshape.check @@ -2,12 +2,12 @@ Macros_Test_2.scala:2: error: macro implementation reference has wrong shape. re macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo1(x: Any) = macro 2 - ^ + ^ Macros_Test_2.scala:3: error: macro implementation reference has wrong shape. required: macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo2(x: Any) = macro Impls.foo(null)(null) - ^ + ^ Macros_Test_2.scala:4: error: missing arguments for method foo in object Impls; follow this method with `_' if you want to treat it as a partially applied function def foo3(x: Any) = macro {2; Impls.foo} @@ -16,5 +16,5 @@ Macros_Test_2.scala:7: error: macro implementation reference has wrong shape. re macro [<static object>].<method name>[[<type args>]] or macro [<macro bundle>].<method name>[[<type args>]] def foo = macro impl - ^ + ^ four errors found diff --git a/test/files/neg/macro-invalidsig-params-badtype.check b/test/files/neg/macro-invalidsig-params-badtype.check index e0cd63fbe4..6d72185ff2 100644 --- a/test/files/neg/macro-invalidsig-params-badtype.check +++ b/test/files/neg/macro-invalidsig-params-badtype.check @@ -1,8 +1,8 @@ -Impls_Macros_1.scala:8: error: macro implementation has wrong shape: +Impls_Macros_1.scala:8: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(x: Int): Nothing type mismatch for parameter x: c.Expr[Int] does not conform to Int def foo(x: Int) = macro Impls.foo - ^ + ^ one error found diff --git a/test/files/neg/macro-invalidsig.check b/test/files/neg/macro-invalidsig.check index 42b8db5628..e09d46146d 100644 --- a/test/files/neg/macro-invalidsig.check +++ b/test/files/neg/macro-invalidsig.check @@ -1,92 +1,84 @@ -Macros_Test_2.scala:2: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] - or : (c: scala.reflect.macros.BlackboxContext): c.Tree - found : (c: scala.reflect.macros.BlackboxContext)(implicit evidence$2: Numeric[U]): c.universe.Literal -macro implementations cannot have implicit parameters other than WeakTypeTag evidences +Macros_Test_2.scala:2: error: macro implementations cannot have implicit parameters other than WeakTypeTag evidences def foo[U] = macro Impls1.foo[U] - ^ -Macros_Test_2.scala:6: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:6: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : : Nothing number of parameter sections differ def foo = macro Impls2.foo - ^ -Macros_Test_2.scala:10: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:10: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : (c: scala.reflect.api.Universe): Nothing type mismatch for parameter c: scala.reflect.macros.BlackboxContext does not conform to scala.reflect.api.Universe def foo = macro Impls3.foo - ^ -Macros_Test_2.scala:14: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:14: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : (cs: scala.reflect.macros.BlackboxContext*): Nothing types incompatible for parameter cs: corresponding is not a vararg parameter def foo = macro Impls4.foo - ^ -Macros_Test_2.scala:18: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:18: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Any]): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext): Nothing number of parameter sections differ def foo(x: Any) = macro Impls5.foo - ^ -Macros_Test_2.scala:22: error: macro implementation has wrong shape: - required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Unit] - or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree - found : (c: scala.reflect.macros.BlackboxContext)(implicit x: c.Expr[Int]): c.Expr[Unit] -macro implementations cannot have implicit parameters other than WeakTypeTag evidences + ^ +Macros_Test_2.scala:22: error: macro implementations cannot have implicit parameters other than WeakTypeTag evidences def foo[U](x: Int) = macro Impls6.foo[T, U] - ^ -Macros_Test_2.scala:26: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:26: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): Nothing parameter lists have different length, found extra parameter y: c.Expr[Int] def foo(x: Int) = macro Impls7.foo - ^ -Macros_Test_2.scala:30: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:30: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int]): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(x: c.universe.Symbol): Nothing type mismatch for parameter x: c.Expr[Int] does not conform to c.universe.Symbol def foo(x: Int) = macro Impls8.foo - ^ -Macros_Test_2.scala:34: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:34: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree, y: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(xs: c.Expr[Int]*): Nothing parameter lists have different length, required extra parameter y: c.Expr[Int] def foo(x: Int, y: Int) = macro Impls9.foo - ^ -Macros_Test_2.scala:38: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:38: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext)(x: c.Expr[Int], y: c.Expr[Int]): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext)(x: c.Tree, y: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(y: c.Expr[Int], x: c.Expr[Int]): Nothing parameter names differ: x != y def foo(x: Int, y: Int) = macro Impls10.foo - ^ -Macros_Test_2.scala:42: error: macro implementation has wrong shape: + ^ +Macros_Test_2.scala:42: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext): c.Expr[Any] or : (c: scala.reflect.macros.BlackboxContext): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(U: c.universe.Type): Nothing number of parameter sections differ def foo[U] = macro Impls11.foo[U] - ^ + ^ Macros_Test_2.scala:46: error: type arguments [U] do not conform to method foo's type parameter bounds [U <: String] def foo[U] = macro Impls12.foo[U] ^ Macros_Test_2.scala:50: error: type arguments [U] do not conform to method foo's type parameter bounds [U <: String] def foo[U <: Int] = macro Impls13.foo[U] ^ -Macros_Test_2.scala:54: error: wrong number of type parameters for method foo: [U](c: scala.reflect.macros.BlackboxContext)(implicit evidence$4: c.WeakTypeTag[U])Nothing +Macros_Test_2.scala:54: error: macro implementation reference has too few type arguments for method foo: [U](c: scala.reflect.macros.BlackboxContext)(implicit evidence$4: c.WeakTypeTag[U])Nothing def foo = macro Impls14.foo - ^ -Macros_Test_2.scala:59: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.BlackboxContext)(implicit evidence$5: c.WeakTypeTag[T], implicit evidence$6: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] + ^ +Macros_Test_2.scala:59: error: macro implementation reference has too few type arguments for method foo: [T, U, V](c: scala.reflect.macros.BlackboxContext)(implicit evidence$5: c.WeakTypeTag[T], implicit evidence$6: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] def foo15[V] = macro Impls15.foo - ^ + ^ Macros_Test_2.scala:60: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.BlackboxContext)(implicit evidence$7: c.WeakTypeTag[T], implicit evidence$8: c.WeakTypeTag[U], implicit V: c.WeakTypeTag[V])c.Expr[Unit] def foo16[V] = macro Impls16.foo[V] ^ diff --git a/test/files/neg/macro-quasiquotes.check b/test/files/neg/macro-quasiquotes.check index d000bb5316..338ad42b23 100644 --- a/test/files/neg/macro-quasiquotes.check +++ b/test/files/neg/macro-quasiquotes.check @@ -1,8 +1,8 @@ -Macros_1.scala:14: error: macro implementation has wrong shape: +Macros_1.scala:14: error: macro implementation has incompatible shape: required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Any] or : (x: Impls.this.c.Tree): Impls.this.c.Tree found : (x: Impls.this.c.universe.Block): Impls.this.c.Tree type mismatch for parameter x: Impls.this.c.Expr[Int] does not conform to Impls.this.c.universe.Block def m3(x: Int) = macro Impls.impl3 - ^ + ^ one error found diff --git a/test/files/neg/missing-param-type-tuple.check b/test/files/neg/missing-param-type-tuple.check new file mode 100644 index 0000000000..bc46ba1023 --- /dev/null +++ b/test/files/neg/missing-param-type-tuple.check @@ -0,0 +1,31 @@ +missing-param-type-tuple.scala:3: error: missing parameter type +Note: The expected type requires a one-argument function accepting a 2-Tuple. + Consider a pattern matching anoynmous function, `{ case (a, b) => ... }` + val x: ((Int, Int)) => Int = (a, b) => 0 + ^ +missing-param-type-tuple.scala:3: error: missing parameter type + val x: ((Int, Int)) => Int = (a, b) => 0 + ^ +missing-param-type-tuple.scala:5: error: missing parameter type +Note: The expected type requires a one-argument function accepting a 3-Tuple. + Consider a pattern matching anoynmous function, `{ case (param1, ..., param3) => ... }` + val y: ((Int, Int, Int)) => Int = (a, b, !!) => 0 + ^ +missing-param-type-tuple.scala:5: error: missing parameter type + val y: ((Int, Int, Int)) => Int = (a, b, !!) => 0 + ^ +missing-param-type-tuple.scala:5: error: missing parameter type + val y: ((Int, Int, Int)) => Int = (a, b, !!) => 0 + ^ +missing-param-type-tuple.scala:7: error: missing parameter type +Note: The expected type requires a one-argument function accepting a 3-Tuple. + Consider a pattern matching anoynmous function, `{ case (param1, ..., param3) => ... }` + val z: ((Int, Int, Int)) => Int = (a, NotAVariablePatternName, c) => 0 + ^ +missing-param-type-tuple.scala:7: error: missing parameter type + val z: ((Int, Int, Int)) => Int = (a, NotAVariablePatternName, c) => 0 + ^ +missing-param-type-tuple.scala:7: error: missing parameter type + val z: ((Int, Int, Int)) => Int = (a, NotAVariablePatternName, c) => 0 + ^ +8 errors found diff --git a/test/files/neg/missing-param-type-tuple.scala b/test/files/neg/missing-param-type-tuple.scala new file mode 100644 index 0000000000..72c0c82034 --- /dev/null +++ b/test/files/neg/missing-param-type-tuple.scala @@ -0,0 +1,8 @@ +class C { + + val x: ((Int, Int)) => Int = (a, b) => 0 + + val y: ((Int, Int, Int)) => Int = (a, b, !!) => 0 + + val z: ((Int, Int, Int)) => Int = (a, NotAVariablePatternName, c) => 0 +} diff --git a/test/files/neg/not-a-legal-formal-parameter-tuple.check b/test/files/neg/not-a-legal-formal-parameter-tuple.check new file mode 100644 index 0000000000..2b906b8ff3 --- /dev/null +++ b/test/files/neg/not-a-legal-formal-parameter-tuple.check @@ -0,0 +1,19 @@ +not-a-legal-formal-parameter-tuple.scala:2: error: not a legal formal parameter. +Note: Tuples cannot be directly destructured in method or function parameters. + Either create a single parameter accepting the Tuple2, + or consider a pattern matching anonymous function: `{ case (a, b) => ... } + val x: ((Int, Int) => Int) = (((a, b)) => a) + ^ +not-a-legal-formal-parameter-tuple.scala:3: error: not a legal formal parameter. +Note: Tuples cannot be directly destructured in method or function parameters. + Either create a single parameter accepting the Tuple2, + or consider a pattern matching anonymous function: `{ case (param1, param2) => ... } + val y: ((Int, Int, Int) => Int) = (((a, !!)) => a) + ^ +not-a-legal-formal-parameter-tuple.scala:4: error: not a legal formal parameter. +Note: Tuples cannot be directly destructured in method or function parameters. + Either create a single parameter accepting the Tuple3, + or consider a pattern matching anonymous function: `{ case (param1, ..., param3) => ... } + val z: ((Int, Int, Int) => Int) = (((a, NotAPatternVariableName, c)) => a) + ^ +three errors found diff --git a/test/files/neg/not-a-legal-formal-parameter-tuple.scala b/test/files/neg/not-a-legal-formal-parameter-tuple.scala new file mode 100644 index 0000000000..c7a13557df --- /dev/null +++ b/test/files/neg/not-a-legal-formal-parameter-tuple.scala @@ -0,0 +1,5 @@ +class C { + val x: ((Int, Int) => Int) = (((a, b)) => a) + val y: ((Int, Int, Int) => Int) = (((a, !!)) => a) + val z: ((Int, Int, Int) => Int) = (((a, NotAPatternVariableName, c)) => a) +} diff --git a/test/files/neg/t5689.check b/test/files/neg/t5689.check index e74de40280..9271f709ca 100644 --- a/test/files/neg/t5689.check +++ b/test/files/neg/t5689.check @@ -1,8 +1,8 @@ -t5689.scala:4: error: macro implementation has wrong shape: +t5689.scala:4: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext)(i: c.Expr[Double]): c.Expr[String] or : (c: scala.reflect.macros.BlackboxContext)(i: c.Tree): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(i: c.Expr[Double]): c.Expr[Int] type mismatch for return type: c.Expr[Int] does not conform to c.Expr[String] def returnsString(i: Double): String = macro returnsIntImpl - ^ + ^ one error found diff --git a/test/files/neg/t6123-explaintypes-macros.check b/test/files/neg/t6123-explaintypes-macros.check index 9a0402039b..ef545fcc32 100644 --- a/test/files/neg/t6123-explaintypes-macros.check +++ b/test/files/neg/t6123-explaintypes-macros.check @@ -1,10 +1,10 @@ c.universe.Expr[Any]* <: c.universe.Expr[String]*? false -BadMac_2.scala:6: error: macro implementation has wrong shape: +BadMac_2.scala:6: error: macro implementation has incompatible shape: required: (c: scala.reflect.macros.BlackboxContext)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit] or : (c: scala.reflect.macros.BlackboxContext)(format: c.Tree, params: Tree*): c.Tree found : (c: scala.reflect.macros.BlackboxContext)(format: c.Expr[String], params: c.Expr[String]*): c.Expr[Unit] type mismatch for parameter params: c.Expr[Any]* does not conform to c.Expr[String]* def printf(format: String, params: Any*): Unit = macro printf_impl - ^ + ^ one error found diff --git a/test/files/pos/specializes-sym-crash.scala b/test/files/pos/specializes-sym-crash.scala index c46f435ac4..7778ba277b 100644 --- a/test/files/pos/specializes-sym-crash.scala +++ b/test/files/pos/specializes-sym-crash.scala @@ -2,11 +2,11 @@ import scala.collection._ trait Foo[+A, +Coll, - +This <: GenSeqView[A, Coll] with GenSeqViewLike[A, Coll, This]] -extends GenSeq[A] with GenSeqLike[A, This] with GenIterableView[A, Coll] with GenIterableViewLike[A, Coll, This] { + +This <: SeqView[A, Coll] with SeqViewLike[A, Coll, This]] +extends Seq[A] with SeqLike[A, This] with IterableView[A, Coll] with IterableViewLike[A, Coll, This] { self => - trait Transformed[+B] extends GenSeqView[B, Coll] with super.Transformed[B] { + trait Transformed[+B] extends SeqView[B, Coll] with super.Transformed[B] { def length: Int def apply(idx: Int): B override def toString = viewToString diff --git a/test/files/pos/t4365/a_1.scala b/test/files/pos/t4365/a_1.scala index 6f3405b1ff..a24b57772d 100644 --- a/test/files/pos/t4365/a_1.scala +++ b/test/files/pos/t4365/a_1.scala @@ -2,8 +2,8 @@ import scala.collection._ trait SeqViewLike[+A, +Coll, - +This <: SeqView[A, Coll] with SeqViewLike[A, Coll, This]] - extends Seq[A] with GenSeqViewLike[A, Coll, This] + +This <: SeqView[A, Coll] with SeqViewLike[A, Coll, Nothing]] + extends Seq[A] with GenSeqViewLike[A, Coll, Nothing] { trait Transformed[+B] extends super[GenSeqViewLike].Transformed[B] diff --git a/test/files/pos/t4365/b_1.scala b/test/files/pos/t4365/b_1.scala index e5b5687185..e1423813f1 100644 --- a/test/files/pos/t4365/b_1.scala +++ b/test/files/pos/t4365/b_1.scala @@ -1,9 +1,11 @@ import scala.collection._ +trait GenSeqView0[+A, +Coll] + trait GenSeqViewLike[+A, +Coll, - +This <: GenSeqView[A, Coll] with GenSeqViewLike[A, Coll, This]] -extends GenSeq[A] { + +This <: GenSeqView0[A, Coll] with GenSeqViewLike[A, Coll, Nothing]] +extends GenSeq[A] { self => trait Transformed[+B] { diff --git a/test/files/pos/t8023.scala b/test/files/pos/t8023.scala new file mode 100644 index 0000000000..86824084ed --- /dev/null +++ b/test/files/pos/t8023.scala @@ -0,0 +1,22 @@ +import language._ + + +object Test { + def foo = (null: Any) match { + case a: A[k] => + // error: kinds of the type arguments (k) do not conform to the + // expected kinds of the type parameters (type K) in class B. + new B[k]() + } +} + +class A[K[L[_]]] + +class B[K[M[_]]] + + +object Test2 { + def foo = (null: Any) match { + case a: A[k] => new B[k]() // this one worked before as the info of `A` was complete + } +} diff --git a/test/files/pos/t8023b.scala b/test/files/pos/t8023b.scala new file mode 100644 index 0000000000..94c9b2f8d2 --- /dev/null +++ b/test/files/pos/t8023b.scala @@ -0,0 +1,2 @@ +// this fails with naive attempts to fix SI-8023 +trait T[A <: T[A]] diff --git a/test/files/presentation/ide-t1001388.check b/test/files/presentation/ide-t1001388.check new file mode 100644 index 0000000000..d58f86d6c6 --- /dev/null +++ b/test/files/presentation/ide-t1001388.check @@ -0,0 +1 @@ +Test OK
\ No newline at end of file diff --git a/test/files/presentation/ide-t1001388/Test.scala b/test/files/presentation/ide-t1001388/Test.scala new file mode 100644 index 0000000000..f6079cf0b2 --- /dev/null +++ b/test/files/presentation/ide-t1001388/Test.scala @@ -0,0 +1,28 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest +import scala.reflect.internal.util.SourceFile +import scala.tools.nsc.interactive.Response + +object Test extends InteractiveTest { + override def execute(): Unit = { + val sourceA = loadSourceAndWaitUntilTypechecked("A.scala") + checkPresent(sourceA) + } + + private def loadSourceAndWaitUntilTypechecked(sourceName: String): SourceFile = { + val sourceFile = sourceFiles.find(_.file.name == sourceName).head + askLoadedTyped(sourceFile).get + /* The response to `askLoadedType` may return before `interactive.Global.waitLoadedType` + * fully executes. Because this test expects `waitLoadedType` is fully executed before + * calling `checkPresent`, with the below no-op presentation compiler request we make + * sure this requirement is fulfilled. + */ + compiler.askForResponse(() => ()).get + sourceFile + } + + private def checkPresent(source: SourceFile): Unit = compiler.getUnitOf(source) match { + case Some(unit) => reporter.println("Compilation Unit for " + source.file.name + " still loaded after askLoadedTyped") + + case None => reporter.println("Test OK") + } +} diff --git a/test/files/presentation/ide-t1001388/src/a/A.scala b/test/files/presentation/ide-t1001388/src/a/A.scala new file mode 100644 index 0000000000..be09097598 --- /dev/null +++ b/test/files/presentation/ide-t1001388/src/a/A.scala @@ -0,0 +1,6 @@ +package a + +object A { + val tagString = "foo" + Seq.empty[Byte].toArray.toSeq +} diff --git a/test/files/presentation/t7548.check b/test/files/presentation/t7548.check new file mode 100644 index 0000000000..5bfb0d27fe --- /dev/null +++ b/test/files/presentation/t7548.check @@ -0,0 +1 @@ +(x: Int)Unit diff --git a/test/files/presentation/t7548/Test.scala b/test/files/presentation/t7548/Test.scala new file mode 100644 index 0000000000..94a6048056 --- /dev/null +++ b/test/files/presentation/t7548/Test.scala @@ -0,0 +1,17 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest + +object Test extends InteractiveTest { + override protected def loadSources() { /* don't parse or typecheck sources */ } + + import compiler._ + + override def runDefaultTests() { + val res = new Response[Tree] + val pos = compiler.rangePos(sourceFiles.head, 102,102,102) + compiler.askTypeAt(pos, res) + res.get match { + case Left(tree) => compiler.ask(() => reporter.println(tree.tpe)) + case Right(ex) => reporter.println(ex) + } + } +} diff --git a/test/files/presentation/t7548/src/Foo.scala b/test/files/presentation/t7548/src/Foo.scala new file mode 100644 index 0000000000..cc997f6e5f --- /dev/null +++ b/test/files/presentation/t7548/src/Foo.scala @@ -0,0 +1,7 @@ +object Foo { + def foo(x: Int) = {} + def foo(x: String) = {} + def foo(x: Int, y: String) = {} + + foo(2) +}
\ No newline at end of file diff --git a/test/files/presentation/t7548b.check b/test/files/presentation/t7548b.check new file mode 100644 index 0000000000..35445fedf6 --- /dev/null +++ b/test/files/presentation/t7548b.check @@ -0,0 +1 @@ +Foo.this.I2BI(Foo.this.I).+: (other: Foo.BI.type)Unit diff --git a/test/files/presentation/t7548b/Test.scala b/test/files/presentation/t7548b/Test.scala new file mode 100644 index 0000000000..0c022df839 --- /dev/null +++ b/test/files/presentation/t7548b/Test.scala @@ -0,0 +1,17 @@ +import scala.tools.nsc.interactive.tests.InteractiveTest + +object Test extends InteractiveTest { + override protected def loadSources() { /* don't parse or typecheck sources */ } + + import compiler._ + + override def runDefaultTests() { + val res = new Response[Tree] + val pos = compiler.rangePos(sourceFiles.head, 191, 191, 191) // + + compiler.askTypeAt(pos, res) + res.get match { + case Left(tree) => compiler.ask(() => reporter.println(s"$tree: ${tree.tpe}")) + case Right(ex) => reporter.println(ex) + } + } +} diff --git a/test/files/presentation/t7548b/src/Foo.scala b/test/files/presentation/t7548b/src/Foo.scala new file mode 100644 index 0000000000..5cf0a4ef4e --- /dev/null +++ b/test/files/presentation/t7548b/src/Foo.scala @@ -0,0 +1,12 @@ +import language._ + +object Foo { + object I { + def +(other: I.type) : Unit = () + } + object BI { + def +(other: BI.type): Unit = () + } + implicit def I2BI(i: I.type): BI.type = BI + I.+(BI) +} |