diff options
Diffstat (limited to 'test/files/neg')
19 files changed, 116 insertions, 15 deletions
diff --git a/test/files/neg/case-collision.flags b/test/files/neg/case-collision.flags index 85d8eb2ba2..14c1069dee 100644 --- a/test/files/neg/case-collision.flags +++ b/test/files/neg/case-collision.flags @@ -1 +1 @@ --Xfatal-warnings +-Ybackend:GenASM -Xfatal-warnings diff --git a/test/files/neg/case-collision2.check b/test/files/neg/case-collision2.check new file mode 100644 index 0000000000..b8481f46bb --- /dev/null +++ b/test/files/neg/case-collision2.check @@ -0,0 +1,12 @@ +case-collision2.scala:5: warning: Class foo.BIPPY differs only in case from foo.Bippy. Such classes will overwrite one another on case-insensitive filesystems. +class BIPPY + ^ +case-collision2.scala:8: warning: Class foo.DINGO$ differs only in case from foo.Dingo$. Such classes will overwrite one another on case-insensitive filesystems. +object DINGO + ^ +case-collision2.scala:11: warning: Class foo.HyRaX$ differs only in case from foo.Hyrax$. Such classes will overwrite one another on case-insensitive filesystems. +object HyRaX + ^ +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/case-collision2.flags b/test/files/neg/case-collision2.flags new file mode 100644 index 0000000000..5bfa9da5c5 --- /dev/null +++ b/test/files/neg/case-collision2.flags @@ -0,0 +1 @@ +-Ynooptimize -Ybackend:GenBCode -Xfatal-warnings diff --git a/test/files/neg/case-collision2.scala b/test/files/neg/case-collision2.scala new file mode 100644 index 0000000000..924e33005a --- /dev/null +++ b/test/files/neg/case-collision2.scala @@ -0,0 +1,12 @@ +package foo + +class Bippy + +class BIPPY + +object Dingo +object DINGO + +case class Hyrax() +object HyRaX + diff --git a/test/files/neg/macro-quasiquotes.check b/test/files/neg/macro-quasiquotes.check new file mode 100644 index 0000000000..a2d48723b5 --- /dev/null +++ b/test/files/neg/macro-quasiquotes.check @@ -0,0 +1,7 @@ +Macros_1.scala:14: error: macro implementation has wrong shape: + required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Any] + found : (x: Impls.this.c.universe.Block): Impls.this.c.universe.Apply +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/macro-quasiquotes/Macros_1.scala b/test/files/neg/macro-quasiquotes/Macros_1.scala new file mode 100644 index 0000000000..17c1034720 --- /dev/null +++ b/test/files/neg/macro-quasiquotes/Macros_1.scala @@ -0,0 +1,15 @@ +import language.experimental.macros +import scala.reflect.macros.Macro + +trait Impls extends Macro { + import c.universe._ + def impl1(x: Expr[Int]) = q"println(x)" + def impl2(x: Tree) = q"println(x)" + def impl3(x: Block) = q"println(x)" +} + +object Macros { + def m1(x: Int) = macro Impls.impl1 + def m2(x: Int) = macro Impls.impl2 + def m3(x: Int) = macro Impls.impl3 +}
\ No newline at end of file diff --git a/test/files/neg/macro-quasiquotes/Test_2.scala b/test/files/neg/macro-quasiquotes/Test_2.scala new file mode 100644 index 0000000000..c7b8948d79 --- /dev/null +++ b/test/files/neg/macro-quasiquotes/Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + Macros.m1 + Macros.m2 + Macros.m3 +} diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check index f6bd703e1f..cdc12c2490 100644 --- a/test/files/neg/names-defaults-neg.check +++ b/test/files/neg/names-defaults-neg.check @@ -125,9 +125,12 @@ names-defaults-neg.scala:134: error: missing parameter type for expanded functio names-defaults-neg.scala:135: error: parameter 'a' is already specified at parameter position 1 val taf3 = testAnnFun(b = _: String, a = get(8)) ^ -names-defaults-neg.scala:136: error: wrong number of parameters; expected = 2 +names-defaults-neg.scala:136: error: missing parameter type for expanded function ((x$3) => testAnnFun(x$3, ((x$4) => b = x$4))) val taf4: (Int, String) => Unit = testAnnFun(_, b = _) - ^ + ^ +names-defaults-neg.scala:136: error: missing parameter type for expanded function ((x$4) => b = x$4) + val taf4: (Int, String) => Unit = testAnnFun(_, b = _) + ^ names-defaults-neg.scala:144: error: variable definition needs type because 'x' is used as a named argument in its body. def t3 { var x = t.f(x = 1) } ^ @@ -165,4 +168,4 @@ names-defaults-neg.scala:180: error: reference to x is ambiguous; it is both a m class u18 { var x: Int = u.f(x = 1) } ^ four warnings found -41 errors found +42 errors found diff --git a/test/files/neg/t1181.check b/test/files/neg/t1181.check index 3724752a85..13b73d5381 100644 --- a/test/files/neg/t1181.check +++ b/test/files/neg/t1181.check @@ -1,8 +1,10 @@ t1181.scala:8: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses case (Nil, Nil) => map ^ -t1181.scala:9: error: missing parameter type +t1181.scala:9: error: type mismatch; + found : scala.collection.immutable.Map[Symbol,Symbol] + required: Symbol _ => buildMap(map.updated(keyList.head, valueList.head), keyList.tail, valueList.tail) - ^ + ^ one warning found one error found diff --git a/test/files/neg/t556.check b/test/files/neg/t556.check index c278e13991..5135dc92ef 100644 --- a/test/files/neg/t556.check +++ b/test/files/neg/t556.check @@ -1,4 +1,4 @@ -t556.scala:3: error: wrong number of parameters; expected = 1 +t556.scala:3: error: missing parameter type def g:Int = f((x,y)=>x) - ^ + ^ one error found diff --git a/test/files/neg/t6123-explaintypes-macros.check b/test/files/neg/t6123-explaintypes-macros.check new file mode 100644 index 0000000000..ebcb8069d5 --- /dev/null +++ b/test/files/neg/t6123-explaintypes-macros.check @@ -0,0 +1,9 @@ +c.universe.Expr[Any]* <: c.universe.Expr[String]*? +false +BadMac_2.scala:6: error: macro implementation has wrong shape: + required: (c: scala.reflect.macros.Context)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit] + found : (c: scala.reflect.macros.Context)(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/neg/t6123-explaintypes-macros/BadMac_2.flags b/test/files/neg/t6123-explaintypes-macros/BadMac_2.flags new file mode 100644 index 0000000000..b36707c7cf --- /dev/null +++ b/test/files/neg/t6123-explaintypes-macros/BadMac_2.flags @@ -0,0 +1 @@ +-explaintypes diff --git a/test/files/neg/t6123-explaintypes-macros/BadMac_2.scala b/test/files/neg/t6123-explaintypes-macros/BadMac_2.scala new file mode 100644 index 0000000000..38b8e24444 --- /dev/null +++ b/test/files/neg/t6123-explaintypes-macros/BadMac_2.scala @@ -0,0 +1,8 @@ +import scala.language.experimental.macros +import scala.reflect.macros.Context + +// explain some macro types to me +object BadMac { + def printf(format: String, params: Any*): Unit = macro printf_impl + def printf_impl(c: Context)(format: c.Expr[String], params: c.Expr[String]*): c.Expr[Unit] = ??? +} diff --git a/test/files/neg/t6123-explaintypes-macros/Macros.flags b/test/files/neg/t6123-explaintypes-macros/Macros.flags new file mode 100644 index 0000000000..b36707c7cf --- /dev/null +++ b/test/files/neg/t6123-explaintypes-macros/Macros.flags @@ -0,0 +1 @@ +-explaintypes diff --git a/test/files/neg/t6123-explaintypes-macros/Macros.scala b/test/files/neg/t6123-explaintypes-macros/Macros.scala new file mode 100644 index 0000000000..a12c277c86 --- /dev/null +++ b/test/files/neg/t6123-explaintypes-macros/Macros.scala @@ -0,0 +1,10 @@ +import scala.language.experimental.macros +import scala.reflect.macros.Context + +object Macros { + def printf(format: String, params: Any*): Unit = macro printf_impl + def printf_impl(c: Context)(format: c.Expr[String], params: c.Expr[Any]*): c.Expr[Unit] = ??? +} + +// something trivial to run +object Test extends App diff --git a/test/files/neg/t6574.check b/test/files/neg/t6574.check new file mode 100644 index 0000000000..c67b4ed804 --- /dev/null +++ b/test/files/neg/t6574.check @@ -0,0 +1,7 @@ +t6574.scala:4: error: could not optimize @tailrec annotated method notTailPos$extension: it contains a recursive call not in tail position + println("tail") + ^ +t6574.scala:8: error: could not optimize @tailrec annotated method differentTypeArgs$extension: it is called recursively with different type arguments + {(); new Bad[String, Unit](0)}.differentTypeArgs + ^ +two errors found diff --git a/test/files/neg/t6574.scala b/test/files/neg/t6574.scala new file mode 100644 index 0000000000..bba97ad62e --- /dev/null +++ b/test/files/neg/t6574.scala @@ -0,0 +1,10 @@ +class Bad[X, Y](val v: Int) extends AnyVal { + @annotation.tailrec final def notTailPos[Z](a: Int)(b: String) { + this.notTailPos[Z](a)(b) + println("tail") + } + + @annotation.tailrec final def differentTypeArgs { + {(); new Bad[String, Unit](0)}.differentTypeArgs + } +} diff --git a/test/files/neg/valueclasses-impl-restrictions.check b/test/files/neg/valueclasses-impl-restrictions.check index 63924493aa..0af9173f74 100644 --- a/test/files/neg/valueclasses-impl-restrictions.check +++ b/test/files/neg/valueclasses-impl-restrictions.check @@ -6,12 +6,8 @@ valueclasses-impl-restrictions.scala:9: error: implementation restriction: neste This restriction is planned to be removed in subsequent releases. trait I2 { ^ -valueclasses-impl-restrictions.scala:15: error: implementation restriction: nested class is not allowed in value class -This restriction is planned to be removed in subsequent releases. - val i2 = new I2 { val q = x.s } - ^ -valueclasses-impl-restrictions.scala:21: error: implementation restriction: nested class is not allowed in value class +valueclasses-impl-restrictions.scala:23: error: implementation restriction: nested class is not allowed in value class This restriction is planned to be removed in subsequent releases. private[this] class I2(val q: String) ^ -four errors found +three errors found diff --git a/test/files/neg/valueclasses-impl-restrictions.scala b/test/files/neg/valueclasses-impl-restrictions.scala index 137f3f854c..f0577a94aa 100644 --- a/test/files/neg/valueclasses-impl-restrictions.scala +++ b/test/files/neg/valueclasses-impl-restrictions.scala @@ -12,8 +12,10 @@ class X1(val s: String) extends AnyVal { } def y(x: X1) = { - val i2 = new I2 { val q = x.s } + val i2 = new I2 { val q = x.s } // allowed as of SI-7571 i2.z + + { case x => x } : PartialFunction[Int, Int] // allowed } } |