diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t8325-b.check | 10 | ||||
-rw-r--r-- | test/files/neg/t8325-b.scala | 4 | ||||
-rw-r--r-- | test/files/neg/t8325-c.check | 7 | ||||
-rw-r--r-- | test/files/neg/t8325-c.scala | 4 | ||||
-rw-r--r-- | test/files/neg/t8325.check | 15 | ||||
-rw-r--r-- | test/files/neg/t8325.scala | 11 | ||||
-rw-r--r-- | test/files/pos/t8157-2.10.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t8157-2.10.scala | 5 | ||||
-rw-r--r-- | test/files/pos/t8325.scala | 9 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/TypecheckedProps.scala | 9 |
10 files changed, 70 insertions, 5 deletions
diff --git a/test/files/neg/t8325-b.check b/test/files/neg/t8325-b.check new file mode 100644 index 0000000000..ec80826dc0 --- /dev/null +++ b/test/files/neg/t8325-b.check @@ -0,0 +1,10 @@ +t8325-b.scala:3: error: Unmatched closing brace '}' ignored here + def k(is: Int*} = ??? + ^ +t8325-b.scala:3: error: ';' expected but '=' found. + def k(is: Int*} = ??? + ^ +t8325-b.scala:4: error: eof expected but '}' found. +} +^ +three errors found diff --git a/test/files/neg/t8325-b.scala b/test/files/neg/t8325-b.scala new file mode 100644 index 0000000000..6ac78708bb --- /dev/null +++ b/test/files/neg/t8325-b.scala @@ -0,0 +1,4 @@ + +trait Test { + def k(is: Int*} = ??? +} diff --git a/test/files/neg/t8325-c.check b/test/files/neg/t8325-c.check new file mode 100644 index 0000000000..51ea4988a6 --- /dev/null +++ b/test/files/neg/t8325-c.check @@ -0,0 +1,7 @@ +t8325-c.scala:3: error: identifier expected but ')' found. + def k(xx: Int`*`) = ??? + ^ +t8325-c.scala:4: error: ')' expected but '}' found. +} +^ +two errors found diff --git a/test/files/neg/t8325-c.scala b/test/files/neg/t8325-c.scala new file mode 100644 index 0000000000..076202df3f --- /dev/null +++ b/test/files/neg/t8325-c.scala @@ -0,0 +1,4 @@ + +trait Test { + def k(xx: Int`*`) = ??? +} diff --git a/test/files/neg/t8325.check b/test/files/neg/t8325.check new file mode 100644 index 0000000000..175a0db415 --- /dev/null +++ b/test/files/neg/t8325.check @@ -0,0 +1,15 @@ +t8325.scala:5: error: *-parameter must come last + def f(is: Int*, s: String) = ??? + ^ +t8325.scala:7: error: *-parameter must come last + def h(is: Int * String *, s: String) = ??? + ^ +t8325.scala:10: error: type mismatch; + found : Int(5) + required: Int* + def j(is: Int* = 5) = ??? + ^ +t8325.scala:10: error: a parameter section with a `*'-parameter is not allowed to have default arguments + def j(is: Int* = 5) = ??? + ^ +four errors found diff --git a/test/files/neg/t8325.scala b/test/files/neg/t8325.scala new file mode 100644 index 0000000000..3813797e83 --- /dev/null +++ b/test/files/neg/t8325.scala @@ -0,0 +1,11 @@ + +trait Test { + type OK[A,B] = A Tuple2 B + type *[A,B] = A Tuple2 B + def f(is: Int*, s: String) = ??? + def g(is: Int * String, s: String) = ??? // OK + def h(is: Int * String *, s: String) = ??? + // won't recover from following + //def i(is: Int OK) = ??? //error: identifier expected but ')' found. + def j(is: Int* = 5) = ??? +} diff --git a/test/files/pos/t8157-2.10.flags b/test/files/pos/t8157-2.10.flags new file mode 100644 index 0000000000..94c8056747 --- /dev/null +++ b/test/files/pos/t8157-2.10.flags @@ -0,0 +1 @@ +-Xsource:2.10 diff --git a/test/files/pos/t8157-2.10.scala b/test/files/pos/t8157-2.10.scala new file mode 100644 index 0000000000..597585a96d --- /dev/null +++ b/test/files/pos/t8157-2.10.scala @@ -0,0 +1,5 @@ +object Test { // PolyTYped function default arg unicity check, + // fails in 2.11, authorized under -Xsource:2.10 + def foo(printer: Any, question: => String, show: Boolean = false)(op: => Any): Any = ??? + def foo[T](question: => String, show: Boolean)(op: => Any = ()): Any = ??? +} diff --git a/test/files/pos/t8325.scala b/test/files/pos/t8325.scala new file mode 100644 index 0000000000..af33ee7bb3 --- /dev/null +++ b/test/files/pos/t8325.scala @@ -0,0 +1,9 @@ + +trait Test { + type +[A, B] = (A, B) + type *[A, B] = (A, B) + + type X[A, B] = A + B + type Y[A, B] = A * B + type Z[A, B] = A `*` B +} diff --git a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala b/test/files/scalacheck/quasiquotes/TypecheckedProps.scala index a5d526191f..f84df269ca 100644 --- a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala +++ b/test/files/scalacheck/quasiquotes/TypecheckedProps.scala @@ -1,9 +1,8 @@ import org.scalacheck._, Prop._, Gen._, Arbitrary._ import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport._ -object TypecheckedProps extends QuasiquoteProperties("typechecked") { - - +object TypecheckedProps extends QuasiquoteProperties("typechecked") + with TypecheckedTypes { property("tuple term") = test { val q"(..$elements)" = typecheck(q"(1, 2)") assert(elements ≈ List(q"1", q"2")) @@ -166,7 +165,7 @@ trait TypecheckedTypes { self: QuasiquoteProperties => } property("applied type") = test { - val tt = typecheckTyp(q"Map[Int, Int]") + val tt = typecheckTyp(tq"Map[Int, Int]") val tq"$tpt[..$tpts]" = tt val tq"scala.this.Predef.Map" = tpt val List(tq"scala.Int", tq"scala.Int") = tpts @@ -205,7 +204,7 @@ trait TypecheckedTypes { self: QuasiquoteProperties => property("annotated type") = test { val tq"$tpt @$annot" = typecheckTyp(tq"Int @unchecked") val tq"scala.Int" = tpt - val q"new unchecked" = annot + val tq"unchecked" = annot } property("existential type") = test { |