diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-08-14 08:56:26 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-08-14 09:37:19 +0200 |
commit | 3ccaa1026e7e74d99fe39c9608e28c48b422e2c9 (patch) | |
tree | a1187b22900d5904f9ba6e5664440a8248491f5a /test/files/neg | |
parent | 48d9fb7307fb6519fe786a7d9be97996c5812fb7 (diff) | |
parent | 12baa2ea399b4f281c62fd20479c1e626f244d03 (diff) | |
download | scala-3ccaa1026e7e74d99fe39c9608e28c48b422e2c9.tar.gz scala-3ccaa1026e7e74d99fe39c9608e28c48b422e2c9.tar.bz2 scala-3ccaa1026e7e74d99fe39c9608e28c48b422e2c9.zip |
Merge branch '2.10.x'
Conflicts:
src/compiler/scala/tools/nsc/Global.scala
src/compiler/scala/tools/nsc/typechecker/Typers.scala
test/files/neg/t6048.check
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/catch-all.check | 6 | ||||
-rw-r--r-- | test/files/neg/macro-invalidsig-context-bounds.check | 8 | ||||
-rw-r--r-- | test/files/neg/macro-invalidsig-implicit-params.check | 8 | ||||
-rw-r--r-- | test/files/neg/newpat_unreachable.check | 29 | ||||
-rw-r--r-- | test/files/neg/newpat_unreachable.flags | 1 | ||||
-rw-r--r-- | test/files/neg/newpat_unreachable.scala | 29 | ||||
-rw-r--r-- | test/files/neg/nonlocal-warning.check | 2 | ||||
-rw-r--r-- | test/files/neg/pat_unreachable.check | 8 | ||||
-rw-r--r-- | test/files/neg/pat_unreachable.scala | 8 | ||||
-rw-r--r-- | test/files/neg/t4425.check | 5 | ||||
-rw-r--r-- | test/files/neg/t4425.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t5148.check | 5 | ||||
-rw-r--r-- | test/files/neg/t5687.check | 8 | ||||
-rw-r--r-- | test/files/neg/t5687.scala | 55 | ||||
-rw-r--r-- | test/files/neg/t6040.check | 7 | ||||
-rw-r--r-- | test/files/neg/t6040.scala | 1 | ||||
-rw-r--r-- | test/files/neg/t6048.check | 7 | ||||
-rw-r--r-- | test/files/neg/t6214.check | 4 | ||||
-rw-r--r-- | test/files/neg/t6214.scala | 7 |
19 files changed, 178 insertions, 21 deletions
diff --git a/test/files/neg/catch-all.check b/test/files/neg/catch-all.check index d59e826f03..aaf51480c3 100644 --- a/test/files/neg/catch-all.check +++ b/test/files/neg/catch-all.check @@ -1,10 +1,10 @@ -catch-all.scala:2: warning: This catches all Throwables. If this is really intended, use `case _: Throwable` to clear this warning. +catch-all.scala:2: warning: This catches all Throwables. If this is really intended, use `case _ : Throwable` to clear this warning. try { "warn" } catch { case _ => } ^ -catch-all.scala:4: warning: This catches all Throwables. If this is really intended, use `case x: Throwable` to clear this warning. +catch-all.scala:4: warning: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning. try { "warn" } catch { case x => } ^ -catch-all.scala:6: warning: This catches all Throwables. If this is really intended, use `case x: Throwable` to clear this warning. +catch-all.scala:6: warning: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning. try { "warn" } catch { case _: RuntimeException => ; case x => } ^ error: No warnings can be incurred under -Xfatal-warnings. diff --git a/test/files/neg/macro-invalidsig-context-bounds.check b/test/files/neg/macro-invalidsig-context-bounds.check index 894eabc442..6c9482e537 100644 --- a/test/files/neg/macro-invalidsig-context-bounds.check +++ b/test/files/neg/macro-invalidsig-context-bounds.check @@ -1,4 +1,4 @@ -Impls_1.scala:5: error: macro implementations cannot have implicit parameters other than AbsTypeTag evidences
- def foo[U: c.AbsTypeTag: Numeric](c: Ctx) = {
- ^
-one error found
+Impls_1.scala:5: error: macro implementations cannot have implicit parameters other than AbsTypeTag evidences + def foo[U: c.AbsTypeTag: Numeric](c: Ctx) = { + ^ +one error found diff --git a/test/files/neg/macro-invalidsig-implicit-params.check b/test/files/neg/macro-invalidsig-implicit-params.check index 029b8a4634..98b3167b7a 100644 --- a/test/files/neg/macro-invalidsig-implicit-params.check +++ b/test/files/neg/macro-invalidsig-implicit-params.check @@ -1,4 +1,4 @@ -Impls_Macros_1.scala:5: error: macro implementations cannot have implicit parameters other than AbsTypeTag evidences
- def foo_targs[T, U: c.AbsTypeTag](c: Ctx)(implicit x: c.Expr[Int]) = {
- ^
-one error found
+Impls_Macros_1.scala:5: error: macro implementations cannot have implicit parameters other than AbsTypeTag evidences + def foo_targs[T, U: c.AbsTypeTag](c: Ctx)(implicit x: c.Expr[Int]) = { + ^ +one error found diff --git a/test/files/neg/newpat_unreachable.check b/test/files/neg/newpat_unreachable.check new file mode 100644 index 0000000000..a928e3853a --- /dev/null +++ b/test/files/neg/newpat_unreachable.check @@ -0,0 +1,29 @@ +newpat_unreachable.scala:6: warning: patterns after a variable pattern cannot match (SLS 8.1.1) +If you intended to match against parameter b of method contrivedExample, you must use backticks, like: case `b` => + case b => println("matched b") + ^ +newpat_unreachable.scala:7: warning: unreachable code due to variable pattern 'b' on line 6 +If you intended to match against parameter c of method contrivedExample, you must use backticks, like: case `c` => + case c => println("matched c") + ^ +newpat_unreachable.scala:8: warning: unreachable code due to variable pattern 'b' on line 6 +If you intended to match against value d in class A, you must use backticks, like: case `d` => + case d => println("matched d") + ^ +newpat_unreachable.scala:9: warning: unreachable code due to variable pattern 'b' on line 6 + case _ => println("matched neither") + ^ +newpat_unreachable.scala:22: warning: patterns after a variable pattern cannot match (SLS 8.1.1) +If you intended to match against parameter b of method g, you must use backticks, like: case `b` => + case b => 1 + ^ +newpat_unreachable.scala:23: warning: unreachable code due to variable pattern 'b' on line 22 +If you intended to match against parameter c of method h, you must use backticks, like: case `c` => + case c => 2 + ^ +newpat_unreachable.scala:24: warning: unreachable code due to variable pattern 'b' on line 22 + case _ => 3 + ^ +error: No warnings can be incurred under -Xfatal-warnings. +7 warnings found +one error found diff --git a/test/files/neg/newpat_unreachable.flags b/test/files/neg/newpat_unreachable.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/neg/newpat_unreachable.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/neg/newpat_unreachable.scala b/test/files/neg/newpat_unreachable.scala new file mode 100644 index 0000000000..c9cc85cec6 --- /dev/null +++ b/test/files/neg/newpat_unreachable.scala @@ -0,0 +1,29 @@ +object Test { + class A { + val d = 55 + + def contrivedExample[A, B, C](a: A, b: B, c: C): Unit = a match { + case b => println("matched b") + case c => println("matched c") + case d => println("matched d") + case _ => println("matched neither") + } + + def correctExample[A, B, C](a: A, b: B, c: C): Unit = a match { + case `b` => println("matched b") + case `c` => println("matched c") + case `d` => println("matched d") + case _ => println("matched neither") + } + + def f[A](a: A) = { + def g[B](b: B) = { + def h[C](c: C) = a match { + case b => 1 + case c => 2 + case _ => 3 + } + } + } + } +} diff --git a/test/files/neg/nonlocal-warning.check b/test/files/neg/nonlocal-warning.check index efb3efaaa2..5202df655a 100644 --- a/test/files/neg/nonlocal-warning.check +++ b/test/files/neg/nonlocal-warning.check @@ -1,4 +1,4 @@ -nonlocal-warning.scala:4: warning: This catches all Throwables. If this is really intended, use `case x: Throwable` to clear this warning. +nonlocal-warning.scala:4: warning: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning. catch { case x => 11 } ^ nonlocal-warning.scala:2: warning: catch block may intercept non-local return from method foo diff --git a/test/files/neg/pat_unreachable.check b/test/files/neg/pat_unreachable.check index 4e1463d591..c5706b7fad 100644 --- a/test/files/neg/pat_unreachable.check +++ b/test/files/neg/pat_unreachable.check @@ -4,4 +4,10 @@ pat_unreachable.scala:5: error: unreachable code pat_unreachable.scala:9: error: unreachable code case Seq(x, y) => List(x, y) ^ -two errors found +pat_unreachable.scala:23: error: unreachable code + case c => println("matched c") + ^ +pat_unreachable.scala:24: error: unreachable code + case _ => println("matched neither") + ^ +four errors found diff --git a/test/files/neg/pat_unreachable.scala b/test/files/neg/pat_unreachable.scala index fc0fd41920..1f402e5212 100644 --- a/test/files/neg/pat_unreachable.scala +++ b/test/files/neg/pat_unreachable.scala @@ -8,7 +8,7 @@ object Test extends App { case Seq(x, y, _*) => x::y::Nil case Seq(x, y) => List(x, y) } - + def not_unreachable(xs:Seq[Char]) = xs match { case Seq(x, y, _*) => x::y::Nil case Seq(x) => List(x) @@ -17,4 +17,10 @@ object Test extends App { case Seq(x, y) => x::y::Nil case Seq(x, y, z, _*) => List(x,y) } + + def contrivedExample[A, B, C](a: A, b: B, c: C): Unit = a match { + case b => println("matched b") + case c => println("matched c") + case _ => println("matched neither") + } } diff --git a/test/files/neg/t4425.check b/test/files/neg/t4425.check index a6a1a1fad4..0f2fe6f2d1 100644 --- a/test/files/neg/t4425.check +++ b/test/files/neg/t4425.check @@ -1,5 +1,4 @@ -t4425.scala:3: error: error during expansion of this match (this is a scalac bug). -The underlying error was: value _1 is not a member of object Foo.X +t4425.scala:3: error: isInstanceOf cannot test if value types are references. 42 match { case _ X _ => () } - ^ + ^ one error found diff --git a/test/files/neg/t4425.flags b/test/files/neg/t4425.flags new file mode 100644 index 0000000000..1182725e86 --- /dev/null +++ b/test/files/neg/t4425.flags @@ -0,0 +1 @@ +-optimize
\ No newline at end of file diff --git a/test/files/neg/t5148.check b/test/files/neg/t5148.check index 96eb1fd364..6edfdf2b1e 100644 --- a/test/files/neg/t5148.check +++ b/test/files/neg/t5148.check @@ -1,2 +1,3 @@ -error: bad reference while unpickling Imports.class: term memberHandlers not found in scala.tools.nsc.interpreter.IMain -one error found +error: bad symbolic reference to value global in class IMain - referenced from t5148.scala (a classfile may be missing) +error: bad symbolic reference to value memberHandlers in class IMain - referenced from t5148.scala (a classfile may be missing) +two errors found diff --git a/test/files/neg/t5687.check b/test/files/neg/t5687.check new file mode 100644 index 0000000000..5096077ee5 --- /dev/null +++ b/test/files/neg/t5687.check @@ -0,0 +1,8 @@ +t5687.scala:4: error: type arguments [T] do not conform to class Template's type parameter bounds [T <: AnyRef] + type Repr[T]<:Template[T] + ^ +t5687.scala:20: error: overriding type Repr in class Template with bounds[T] <: Template[T]; + type Repr has incompatible type + type Repr = CurveTemplate[T] + ^ +two errors found diff --git a/test/files/neg/t5687.scala b/test/files/neg/t5687.scala new file mode 100644 index 0000000000..90a9ae265c --- /dev/null +++ b/test/files/neg/t5687.scala @@ -0,0 +1,55 @@ +abstract class Template[T <: AnyRef](private val t: T) { + +// type Repr[A<:AnyRef]<:Template[T] + type Repr[T]<:Template[T] + + def access1(timeout: Int): Repr[T] = this.asInstanceOf[Repr[T]] + def access2: Repr[T] = this.asInstanceOf[Repr[T]] + val access3: Repr[T] = this.asInstanceOf[Repr[T]] + def access4(v: Repr[T]): Repr[T] = this.asInstanceOf[Repr[T]] + def access5(x: X): Repr[T] = this.asInstanceOf[Repr[T]] + def access5(x: Y): Repr[T] = this.asInstanceOf[Repr[T]] + + def withReadModifiers(readModifiers:Int): Repr[T] = this.asInstanceOf[Repr[T]] +} + +class Curve + +class CurveTemplate [T <: Curve](t: T) extends Template(t) { +// type Repr[A<: AnyRef] = CurveTemplate[T] + type Repr = CurveTemplate[T] +} + +class Base +class X extends Base +class Y extends Base + + +object Example { + def test1() { + new CurveTemplate(new Curve).access1(10) + + new CurveTemplate(new Curve).access2 + + new CurveTemplate(new Curve).access3 + + new CurveTemplate(new Curve).access4(null) + + new CurveTemplate(new Curve).access5(new X) + + () + + } + + def test2() { + new CurveTemplate(new Curve).access1(10).withReadModifiers(1) + + new CurveTemplate(new Curve).access2.withReadModifiers(1) + + new CurveTemplate(new Curve).access3.withReadModifiers(1) + + new CurveTemplate(new Curve).access4(null).withReadModifiers(1) + + new CurveTemplate(new Curve).access5(new X).withReadModifiers(1) + } +} diff --git a/test/files/neg/t6040.check b/test/files/neg/t6040.check new file mode 100644 index 0000000000..f44a81c471 --- /dev/null +++ b/test/files/neg/t6040.check @@ -0,0 +1,7 @@ +error: extension of type scala.Dynamic needs to be enabled +by making the implicit value language.dynamics visible. +This can be achieved by adding the import clause 'import language.dynamics' +or by setting the compiler option -language:dynamics. +See the Scala docs for value scala.language.dynamics for a discussion +why the feature needs to be explicitly enabled. +one error found diff --git a/test/files/neg/t6040.scala b/test/files/neg/t6040.scala new file mode 100644 index 0000000000..b8f7dab7a4 --- /dev/null +++ b/test/files/neg/t6040.scala @@ -0,0 +1 @@ +class X extends Dynamic
\ No newline at end of file diff --git a/test/files/neg/t6048.check b/test/files/neg/t6048.check index 319e3fa620..5e11d24fde 100644 --- a/test/files/neg/t6048.check +++ b/test/files/neg/t6048.check @@ -4,9 +4,12 @@ t6048.scala:3: warning: unreachable code t6048.scala:8: warning: unreachable code case _ if false => x // unreachable ^ -t6048.scala:14: warning: unreachable code +t6048.scala:13: warning: patterns after a variable pattern cannot match (SLS 8.1.1) + case _ => x + ^ +t6048.scala:14: warning: unreachable code due to variable pattern on line 13 case 5 if true => x // unreachable ^ error: No warnings can be incurred under -Xfatal-warnings. -three warnings found +four warnings found one error found diff --git a/test/files/neg/t6214.check b/test/files/neg/t6214.check new file mode 100644 index 0000000000..6349a3e71c --- /dev/null +++ b/test/files/neg/t6214.check @@ -0,0 +1,4 @@ +t6214.scala:5: error: missing parameter type + m { s => case class Foo() } + ^ +one error found diff --git a/test/files/neg/t6214.scala b/test/files/neg/t6214.scala new file mode 100644 index 0000000000..734acda35e --- /dev/null +++ b/test/files/neg/t6214.scala @@ -0,0 +1,7 @@ +object Test { + def m(f: String => Unit) = 0 + def m(f: Int => Unit) = 0 + def foo { + m { s => case class Foo() } + } +} |