summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-03-14 10:00:30 -0700
committerPaul Phillips <paulp@improving.org>2012-03-14 10:08:36 -0700
commit3ab383ae01a66208df4955bf2117dd2ea8eb2afe (patch)
treeac83e7e89310955ccbc317f57f34165f9781117c /test/files/neg
parentb6dde2b6cf5f66e96fc92c09c1fbe3b4a8dc348c (diff)
parent5dca64cefeed4bc3289e641949b103e5e806aa32 (diff)
downloadscala-3ab383ae01a66208df4955bf2117dd2ea8eb2afe.tar.gz
scala-3ab383ae01a66208df4955bf2117dd2ea8eb2afe.tar.bz2
scala-3ab383ae01a66208df4955bf2117dd2ea8eb2afe.zip
Merge branch 'master' into merge-inline
Conflicts: lib/scala-compiler.jar.desired.sha1 lib/scala-library-src.jar.desired.sha1 lib/scala-library.jar.desired.sha1 src/compiler/scala/reflect/internal/Definitions.scala src/compiler/scala/reflect/internal/Importers.scala src/compiler/scala/reflect/internal/Symbols.scala src/compiler/scala/reflect/internal/Trees.scala src/compiler/scala/reflect/internal/Types.scala src/compiler/scala/tools/nsc/Global.scala src/compiler/scala/tools/nsc/transform/Erasure.scala src/compiler/scala/tools/nsc/transform/LiftCode.scala src/compiler/scala/tools/nsc/transform/UnCurry.scala src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala test/files/run/programmatic-main.check test/files/speclib/instrumented.jar.desired.sha1
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/abstraction-from-volatile-type-error.check4
-rw-r--r--test/files/neg/abstraction-from-volatile-type-error.scala11
-rw-r--r--test/files/neg/constructor-prefix-error.check4
-rw-r--r--test/files/neg/constructor-prefix-error.scala7
-rw-r--r--test/files/neg/error_dependentMethodTpeConversionToFunction.check4
-rw-r--r--test/files/neg/error_dependentMethodTpeConversionToFunction.scala5
-rw-r--r--test/files/neg/error_tooManyArgsPattern.check4
-rw-r--r--test/files/neg/error_tooManyArgsPattern.scala5
-rw-r--r--test/files/neg/finitary-error.check4
-rw-r--r--test/files/neg/finitary-error.scala3
-rw-r--r--test/files/neg/implicits.check5
-rw-r--r--test/files/neg/implicits.scala16
-rw-r--r--test/files/neg/macro-argtype-mismatch.check6
-rw-r--r--test/files/neg/macro-argtype-mismatch.flags1
-rw-r--r--test/files/neg/macro-argtype-mismatch/Macros_1.scala3
-rw-r--r--test/files/neg/macro-argtype-mismatch/Test_2.scala4
-rw-r--r--test/files/neg/macro-noexpand.check4
-rw-r--r--test/files/neg/macro-noexpand.flags1
-rw-r--r--test/files/neg/macro-noexpand/Macros_1.scala3
-rw-r--r--test/files/neg/macro-noexpand/Test_2.scala4
-rw-r--r--test/files/neg/macro-noncompilertree.check6
-rw-r--r--test/files/neg/macro-noncompilertree.flags1
-rw-r--r--test/files/neg/macro-noncompilertree/Macros_1.scala3
-rw-r--r--test/files/neg/macro-nontree.check6
-rw-r--r--test/files/neg/macro-nontree.flags1
-rw-r--r--test/files/neg/macro-nontree/Macros_1.scala3
-rw-r--r--test/files/neg/parent-inherited-twice-error.check7
-rw-r--r--test/files/neg/parent-inherited-twice-error.scala2
-rw-r--r--test/files/neg/qualifying-class-error-1.check4
-rw-r--r--test/files/neg/qualifying-class-error-1.scala2
-rw-r--r--test/files/neg/qualifying-class-error-2.check4
-rw-r--r--test/files/neg/qualifying-class-error-2.scala11
-rw-r--r--test/files/neg/reify_ann2a.check4
-rw-r--r--test/files/neg/reify_ann2a.scala30
-rw-r--r--test/files/neg/reify_ann2b.check7
-rw-r--r--test/files/neg/reify_ann2b.scala30
-rw-r--r--test/files/neg/t200.check2
-rw-r--r--test/files/neg/t2779.check2
-rw-r--r--test/files/neg/t278.check2
-rw-r--r--test/files/neg/t3275.check4
-rw-r--r--test/files/neg/t3275.scala3
-rw-r--r--test/files/neg/t414.check2
-rw-r--r--test/files/neg/t452.check2
-rw-r--r--test/files/neg/t4879.check4
-rw-r--r--test/files/neg/t5189.check6
-rw-r--r--test/files/neg/t5189.scala5
-rw-r--r--test/files/neg/t5189b.check8
-rw-r--r--test/files/neg/t5189b.scala62
-rw-r--r--test/files/neg/t5358.check7
-rw-r--r--test/files/neg/t5358.scala4
-rw-r--r--test/files/neg/t5429.check132
-rw-r--r--test/files/neg/t5429.scala93
-rw-r--r--test/files/neg/t5452.check8
-rw-r--r--test/files/neg/t5452.scala29
-rw-r--r--test/files/neg/t5455.check4
-rw-r--r--test/files/neg/t5455.scala16
-rw-r--r--test/files/neg/t5493.check4
-rw-r--r--test/files/neg/t5493.scala3
-rw-r--r--test/files/neg/t5497.check4
-rw-r--r--test/files/neg/t5497.scala5
-rw-r--r--test/files/neg/t5529.check12
-rw-r--r--test/files/neg/t5529.scala13
-rw-r--r--test/files/neg/t5553_1.check54
-rw-r--r--test/files/neg/t5553_1.scala34
-rw-r--r--test/files/neg/t5553_2.check50
-rw-r--r--test/files/neg/t5553_2.scala59
-rw-r--r--test/files/neg/t5554.check67
-rw-r--r--test/files/neg/t5554.scala39
-rw-r--r--test/files/neg/t591.check2
-rw-r--r--test/files/neg/t800.check6
-rw-r--r--test/files/neg/t935.check5
-rw-r--r--test/files/neg/t960.check7
-rw-r--r--test/files/neg/t960.scala4
-rw-r--r--test/files/neg/tailrec-2.check7
-rw-r--r--test/files/neg/tailrec-2.scala3
75 files changed, 975 insertions, 17 deletions
diff --git a/test/files/neg/abstraction-from-volatile-type-error.check b/test/files/neg/abstraction-from-volatile-type-error.check
new file mode 100644
index 0000000000..34ba0551a5
--- /dev/null
+++ b/test/files/neg/abstraction-from-volatile-type-error.check
@@ -0,0 +1,4 @@
+abstraction-from-volatile-type-error.scala:9: error: illegal abstraction from value with volatile type a.Tv
+ val tv : a.Tv
+ ^
+one error found
diff --git a/test/files/neg/abstraction-from-volatile-type-error.scala b/test/files/neg/abstraction-from-volatile-type-error.scala
new file mode 100644
index 0000000000..5afcb3ec7d
--- /dev/null
+++ b/test/files/neg/abstraction-from-volatile-type-error.scala
@@ -0,0 +1,11 @@
+class A {
+ type T
+ type Tv = AnyRef with T
+}
+
+object Test {
+ type B = a.type forSome {
+ val a : A
+ val tv : a.Tv
+ }
+}
diff --git a/test/files/neg/constructor-prefix-error.check b/test/files/neg/constructor-prefix-error.check
new file mode 100644
index 0000000000..87e948881b
--- /dev/null
+++ b/test/files/neg/constructor-prefix-error.check
@@ -0,0 +1,4 @@
+constructor-prefix-error.scala:6: error: Outer is not a legal prefix for a constructor
+ val x = new Outer#Inner
+ ^
+one error found
diff --git a/test/files/neg/constructor-prefix-error.scala b/test/files/neg/constructor-prefix-error.scala
new file mode 100644
index 0000000000..c2accea284
--- /dev/null
+++ b/test/files/neg/constructor-prefix-error.scala
@@ -0,0 +1,7 @@
+class Outer {
+ class Inner
+}
+
+object Test {
+ val x = new Outer#Inner
+}
diff --git a/test/files/neg/error_dependentMethodTpeConversionToFunction.check b/test/files/neg/error_dependentMethodTpeConversionToFunction.check
new file mode 100644
index 0000000000..3496a552c4
--- /dev/null
+++ b/test/files/neg/error_dependentMethodTpeConversionToFunction.check
@@ -0,0 +1,4 @@
+error_dependentMethodTpeConversionToFunction.scala:4: error: method with dependent type (x: AnyRef)x.type cannot be converted to function value
+ val x: Any => Any = foo
+ ^
+one error found
diff --git a/test/files/neg/error_dependentMethodTpeConversionToFunction.scala b/test/files/neg/error_dependentMethodTpeConversionToFunction.scala
new file mode 100644
index 0000000000..22649e5098
--- /dev/null
+++ b/test/files/neg/error_dependentMethodTpeConversionToFunction.scala
@@ -0,0 +1,5 @@
+// test DependentMethodTpeConversionToFunctionError
+object Test {
+ def foo(x: AnyRef): x.type = x
+ val x: Any => Any = foo
+} \ No newline at end of file
diff --git a/test/files/neg/error_tooManyArgsPattern.check b/test/files/neg/error_tooManyArgsPattern.check
new file mode 100644
index 0000000000..ee401ad061
--- /dev/null
+++ b/test/files/neg/error_tooManyArgsPattern.check
@@ -0,0 +1,4 @@
+error_tooManyArgsPattern.scala:3: error: too many arguments for unapply pattern, maximum = 22
+ case List(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23) => 7
+ ^
+one error found
diff --git a/test/files/neg/error_tooManyArgsPattern.scala b/test/files/neg/error_tooManyArgsPattern.scala
new file mode 100644
index 0000000000..d55ba61001
--- /dev/null
+++ b/test/files/neg/error_tooManyArgsPattern.scala
@@ -0,0 +1,5 @@
+object Test {
+ def test(xs: Any) = xs match { // test error message TooManyArgsPatternError
+ case List(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23) => 7
+ }
+}
diff --git a/test/files/neg/finitary-error.check b/test/files/neg/finitary-error.check
new file mode 100644
index 0000000000..7bc92058ca
--- /dev/null
+++ b/test/files/neg/finitary-error.check
@@ -0,0 +1,4 @@
+finitary-error.scala:3: error: class graph is not finitary because type parameter T is expansively recursive
+trait C[T] extends A[C[B[T]]]
+ ^
+one error found
diff --git a/test/files/neg/finitary-error.scala b/test/files/neg/finitary-error.scala
new file mode 100644
index 0000000000..a48fcdc70f
--- /dev/null
+++ b/test/files/neg/finitary-error.scala
@@ -0,0 +1,3 @@
+trait A[T]
+trait B[T]
+trait C[T] extends A[C[B[T]]]
diff --git a/test/files/neg/implicits.check b/test/files/neg/implicits.check
index cd9dfebf48..6d61f7f222 100644
--- a/test/files/neg/implicits.check
+++ b/test/files/neg/implicits.check
@@ -8,4 +8,7 @@ implicits.scala:46: error: type mismatch;
required: List[Mxml]
children.toList.flatMap ( e => {
^
-two errors found
+implicits.scala:66: error: could not find implicit value for parameter x: Nothing
+ foo {
+ ^
+three errors found
diff --git a/test/files/neg/implicits.scala b/test/files/neg/implicits.scala
index e908fb03e8..878d3a7c99 100644
--- a/test/files/neg/implicits.scala
+++ b/test/files/neg/implicits.scala
@@ -56,3 +56,19 @@ class Mxml {
}
}
+
+// SI-5316
+class Test3 {
+ def foo(p: => Any)(implicit x: Nothing): Unit = ()
+
+ object X
+
+ foo {
+ val a = 0
+
+ {
+ import X._
+ a
+ }
+ }
+}
diff --git a/test/files/neg/macro-argtype-mismatch.check b/test/files/neg/macro-argtype-mismatch.check
new file mode 100644
index 0000000000..dd867be804
--- /dev/null
+++ b/test/files/neg/macro-argtype-mismatch.check
@@ -0,0 +1,6 @@
+Test_2.scala:3: error: type mismatch;
+ found : String("2")
+ required: Int
+ foo("2")
+ ^
+one error found
diff --git a/test/files/neg/macro-argtype-mismatch.flags b/test/files/neg/macro-argtype-mismatch.flags
new file mode 100644
index 0000000000..7fea2ff901
--- /dev/null
+++ b/test/files/neg/macro-argtype-mismatch.flags
@@ -0,0 +1 @@
+-Xmacros \ No newline at end of file
diff --git a/test/files/neg/macro-argtype-mismatch/Macros_1.scala b/test/files/neg/macro-argtype-mismatch/Macros_1.scala
new file mode 100644
index 0000000000..4b5f98ba37
--- /dev/null
+++ b/test/files/neg/macro-argtype-mismatch/Macros_1.scala
@@ -0,0 +1,3 @@
+object Macros {
+ def macro foo(x: Int) = x
+} \ No newline at end of file
diff --git a/test/files/neg/macro-argtype-mismatch/Test_2.scala b/test/files/neg/macro-argtype-mismatch/Test_2.scala
new file mode 100644
index 0000000000..18feb69425
--- /dev/null
+++ b/test/files/neg/macro-argtype-mismatch/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ import Macros._
+ foo("2")
+} \ No newline at end of file
diff --git a/test/files/neg/macro-noexpand.check b/test/files/neg/macro-noexpand.check
new file mode 100644
index 0000000000..c15d54bb32
--- /dev/null
+++ b/test/files/neg/macro-noexpand.check
@@ -0,0 +1,4 @@
+Test_2.scala:3: error: not found: value x
+ foo(x)
+ ^
+one error found
diff --git a/test/files/neg/macro-noexpand.flags b/test/files/neg/macro-noexpand.flags
new file mode 100644
index 0000000000..7fea2ff901
--- /dev/null
+++ b/test/files/neg/macro-noexpand.flags
@@ -0,0 +1 @@
+-Xmacros \ No newline at end of file
diff --git a/test/files/neg/macro-noexpand/Macros_1.scala b/test/files/neg/macro-noexpand/Macros_1.scala
new file mode 100644
index 0000000000..7a6aadf6a1
--- /dev/null
+++ b/test/files/neg/macro-noexpand/Macros_1.scala
@@ -0,0 +1,3 @@
+object Macros {
+ def macro foo(x: Any) = ???
+} \ No newline at end of file
diff --git a/test/files/neg/macro-noexpand/Test_2.scala b/test/files/neg/macro-noexpand/Test_2.scala
new file mode 100644
index 0000000000..0bed592883
--- /dev/null
+++ b/test/files/neg/macro-noexpand/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ import Macros._
+ foo(x)
+} \ No newline at end of file
diff --git a/test/files/neg/macro-noncompilertree.check b/test/files/neg/macro-noncompilertree.check
new file mode 100644
index 0000000000..616765a39e
--- /dev/null
+++ b/test/files/neg/macro-noncompilertree.check
@@ -0,0 +1,6 @@
+Macros_1.scala:2: error: type mismatch;
+ found : reflect.mirror.Literal
+ required: _context.Tree
+ def macro foo = scala.reflect.mirror.Literal(scala.reflect.mirror.Constant(2))
+ ^
+one error found
diff --git a/test/files/neg/macro-noncompilertree.flags b/test/files/neg/macro-noncompilertree.flags
new file mode 100644
index 0000000000..7fea2ff901
--- /dev/null
+++ b/test/files/neg/macro-noncompilertree.flags
@@ -0,0 +1 @@
+-Xmacros \ No newline at end of file
diff --git a/test/files/neg/macro-noncompilertree/Macros_1.scala b/test/files/neg/macro-noncompilertree/Macros_1.scala
new file mode 100644
index 0000000000..eb1253e5e9
--- /dev/null
+++ b/test/files/neg/macro-noncompilertree/Macros_1.scala
@@ -0,0 +1,3 @@
+object Macros {
+ def macro foo = scala.reflect.mirror.Literal(scala.reflect.mirror.Constant(2))
+} \ No newline at end of file
diff --git a/test/files/neg/macro-nontree.check b/test/files/neg/macro-nontree.check
new file mode 100644
index 0000000000..a1c7139580
--- /dev/null
+++ b/test/files/neg/macro-nontree.check
@@ -0,0 +1,6 @@
+Macros_1.scala:2: error: type mismatch;
+ found : Int(2)
+ required: _context.Tree
+ def macro foo = 2
+ ^
+one error found
diff --git a/test/files/neg/macro-nontree.flags b/test/files/neg/macro-nontree.flags
new file mode 100644
index 0000000000..7fea2ff901
--- /dev/null
+++ b/test/files/neg/macro-nontree.flags
@@ -0,0 +1 @@
+-Xmacros \ No newline at end of file
diff --git a/test/files/neg/macro-nontree/Macros_1.scala b/test/files/neg/macro-nontree/Macros_1.scala
new file mode 100644
index 0000000000..2433974a85
--- /dev/null
+++ b/test/files/neg/macro-nontree/Macros_1.scala
@@ -0,0 +1,3 @@
+object Macros {
+ def macro foo = 2
+} \ No newline at end of file
diff --git a/test/files/neg/parent-inherited-twice-error.check b/test/files/neg/parent-inherited-twice-error.check
new file mode 100644
index 0000000000..521a6c19d0
--- /dev/null
+++ b/test/files/neg/parent-inherited-twice-error.check
@@ -0,0 +1,7 @@
+parent-inherited-twice-error.scala:2: error: trait A is inherited twice
+class B extends A with A
+ ^
+parent-inherited-twice-error.scala:2: error: trait A is inherited twice
+class B extends A with A
+ ^
+two errors found
diff --git a/test/files/neg/parent-inherited-twice-error.scala b/test/files/neg/parent-inherited-twice-error.scala
new file mode 100644
index 0000000000..7b433b9860
--- /dev/null
+++ b/test/files/neg/parent-inherited-twice-error.scala
@@ -0,0 +1,2 @@
+trait A
+class B extends A with A
diff --git a/test/files/neg/qualifying-class-error-1.check b/test/files/neg/qualifying-class-error-1.check
new file mode 100644
index 0000000000..c70db9ba60
--- /dev/null
+++ b/test/files/neg/qualifying-class-error-1.check
@@ -0,0 +1,4 @@
+qualifying-class-error-1.scala:2: error: this can be used only in a class, object, or template
+class B extends A(this.getClass.getName.length)
+ ^
+one error found
diff --git a/test/files/neg/qualifying-class-error-1.scala b/test/files/neg/qualifying-class-error-1.scala
new file mode 100644
index 0000000000..09152fe04c
--- /dev/null
+++ b/test/files/neg/qualifying-class-error-1.scala
@@ -0,0 +1,2 @@
+class A(val i:Int)
+class B extends A(this.getClass.getName.length)
diff --git a/test/files/neg/qualifying-class-error-2.check b/test/files/neg/qualifying-class-error-2.check
new file mode 100644
index 0000000000..50c2759685
--- /dev/null
+++ b/test/files/neg/qualifying-class-error-2.check
@@ -0,0 +1,4 @@
+qualifying-class-error-2.scala:9: error: A is not an enclosing class
+ protected[A] def f() {}
+ ^
+one error found
diff --git a/test/files/neg/qualifying-class-error-2.scala b/test/files/neg/qualifying-class-error-2.scala
new file mode 100644
index 0000000000..d3aa8664bd
--- /dev/null
+++ b/test/files/neg/qualifying-class-error-2.scala
@@ -0,0 +1,11 @@
+package A {
+ trait X {
+ protected[A] def f()
+ }
+}
+
+package B {
+ class Y extends A.X {
+ protected[A] def f() {}
+ }
+}
diff --git a/test/files/neg/reify_ann2a.check b/test/files/neg/reify_ann2a.check
new file mode 100644
index 0000000000..2afe37e1d8
--- /dev/null
+++ b/test/files/neg/reify_ann2a.check
@@ -0,0 +1,4 @@
+reify_ann2a.scala:9: error: exception during macro expansion: implementation restriction: cannot reify annotation @ann(immutable.this.List.apply[String]("1a")) which involves a symbol declared inside the block being reified
+ val tree = scala.reflect.Code.lift{
+ ^
+one error found
diff --git a/test/files/neg/reify_ann2a.scala b/test/files/neg/reify_ann2a.scala
new file mode 100644
index 0000000000..8de0984074
--- /dev/null
+++ b/test/files/neg/reify_ann2a.scala
@@ -0,0 +1,30 @@
+import scala.reflect._
+import scala.reflect.api._
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ // test 1: reify
+ val tree = scala.reflect.Code.lift{
+ class ann(bar: List[String]) extends StaticAnnotation
+
+ @ann(bar=List("1a")) @ann(bar=List("1b")) class C[@ann(bar=List("2a")) @ann(bar=List("2b")) T](@ann(bar=List("3a")) @ann(bar=List("3b")) x: T @ann(bar=List("4a")) @ann(bar=List("4b"))) {
+ @ann(bar=List("5a")) @ann(bar=List("5b")) def f(x: Int @ann(bar=List("6a")) @ann(bar=List("6b"))) = {
+ @ann(bar=List("7a")) @ann(bar=List("7b")) val r = (x + 3): @ann(bar=List("8a")) @ann(bar=List("8b"))
+ val s = 4: Int @ann(bar=List("9a")) @ann(bar=List("9b"))
+ r + s
+ }
+ }
+ }.tree
+ println(tree.toString)
+
+ // test 2: import and typecheck
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(tree)
+ println(ttree.toString)
+
+ // test 3: import and compile
+ toolbox.runExpr(tree)
+} \ No newline at end of file
diff --git a/test/files/neg/reify_ann2b.check b/test/files/neg/reify_ann2b.check
new file mode 100644
index 0000000000..ceb70689f1
--- /dev/null
+++ b/test/files/neg/reify_ann2b.check
@@ -0,0 +1,7 @@
+reify_ann2b.scala:10: error: inner classes cannot be classfile annotations
+ class ann(bar: String) extends ClassfileAnnotation
+ ^
+reify_ann2b.scala:9: error: exception during macro expansion: implementation restriction: cannot reify annotation @ann(bar = "1a") which involves a symbol declared inside the block being reified
+ val tree = scala.reflect.Code.lift{
+ ^
+two errors found
diff --git a/test/files/neg/reify_ann2b.scala b/test/files/neg/reify_ann2b.scala
new file mode 100644
index 0000000000..b43567c2a7
--- /dev/null
+++ b/test/files/neg/reify_ann2b.scala
@@ -0,0 +1,30 @@
+import scala.reflect._
+import scala.reflect.api._
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ // test 1: reify
+ val tree = scala.reflect.Code.lift{
+ class ann(bar: String) extends ClassfileAnnotation
+
+ @ann(bar="1a") @ann(bar="1b") class C[@ann(bar="2a") @ann(bar="2b") T](@ann(bar="3a") @ann(bar="3b") x: T @ann(bar="4a") @ann(bar="4b")) {
+ @ann(bar="5a") @ann(bar="5b") def f(x: Int @ann(bar="6a") @ann(bar="6b")) = {
+ @ann(bar="7a") @ann(bar="7b") val r = (x + 3): @ann(bar="8a") @ann(bar="8b")
+ val s = 4: Int @ann(bar="9a") @ann(bar="9b")
+ r + s
+ }
+ }
+ }.tree
+ println(tree.toString)
+
+ // test 2: import and typecheck
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(tree)
+ println(ttree.toString)
+
+ // test 3: import and compile
+ toolbox.runExpr(tree)
+} \ No newline at end of file
diff --git a/test/files/neg/t200.check b/test/files/neg/t200.check
index 78701f8533..3ef6665fe5 100644
--- a/test/files/neg/t200.check
+++ b/test/files/neg/t200.check
@@ -1,4 +1,4 @@
-t200.scala:7: error: method foo is defined twice
+t200.scala:7: error: method foo is defined twice in t200.scala
def foo: Int;
^
one error found
diff --git a/test/files/neg/t2779.check b/test/files/neg/t2779.check
index 4f94a780a1..d642541e3e 100644
--- a/test/files/neg/t2779.check
+++ b/test/files/neg/t2779.check
@@ -1,4 +1,4 @@
-t2779.scala:16: error: method f is defined twice
+t2779.scala:16: error: method f is defined twice in t2779.scala
override def f = List(M1)
^
one error found
diff --git a/test/files/neg/t278.check b/test/files/neg/t278.check
index 675ef910ee..0c2dfeb67a 100644
--- a/test/files/neg/t278.check
+++ b/test/files/neg/t278.check
@@ -4,7 +4,7 @@ t278.scala:5: error: overloaded method value a with alternatives:
does not take type parameters
println(a[A])
^
-t278.scala:4: error: method a is defined twice
+t278.scala:4: error: method a is defined twice in t278.scala
def a = (p:A) => ()
^
two errors found
diff --git a/test/files/neg/t3275.check b/test/files/neg/t3275.check
new file mode 100644
index 0000000000..117c792321
--- /dev/null
+++ b/test/files/neg/t3275.check
@@ -0,0 +1,4 @@
+t3275.scala:2: error: @tailrec annotated method contains no recursive calls
+ @annotation.tailrec def foo() = 5
+ ^
+one error found
diff --git a/test/files/neg/t3275.scala b/test/files/neg/t3275.scala
new file mode 100644
index 0000000000..18e38a1a97
--- /dev/null
+++ b/test/files/neg/t3275.scala
@@ -0,0 +1,3 @@
+object Test {
+ @annotation.tailrec def foo() = 5
+}
diff --git a/test/files/neg/t414.check b/test/files/neg/t414.check
index a855497648..e15dbaea71 100644
--- a/test/files/neg/t414.check
+++ b/test/files/neg/t414.check
@@ -1,5 +1,5 @@
t414.scala:5: error: pattern type is incompatible with expected type;
- found : object Empty
+ found : Empty.type
required: IntMap[a]
Note: if you intended to match against the class, try `case _: Empty[_]` or `case Empty()`
case Empty =>
diff --git a/test/files/neg/t452.check b/test/files/neg/t452.check
index 85197af21b..aac663068e 100644
--- a/test/files/neg/t452.check
+++ b/test/files/neg/t452.check
@@ -1,5 +1,5 @@
t452.scala:3: error: type mismatch;
- found : Test.type (with underlying type object Test)
+ found : Test.type
required: Test.Foo
def this() = this(this);
^
diff --git a/test/files/neg/t4879.check b/test/files/neg/t4879.check
index 49f3c73cf7..21cd329640 100644
--- a/test/files/neg/t4879.check
+++ b/test/files/neg/t4879.check
@@ -1,11 +1,11 @@
t4879.scala:6: error: pattern type is incompatible with expected type;
- found : object C
+ found : C.type
required: C
Note: if you intended to match against the class, try `case _: C` or `case C(_)`
case C => true
^
t4879.scala:10: error: pattern type is incompatible with expected type;
- found : object D
+ found : D.type
required: D[T,U,V]
Note: if you intended to match against the class, try `case _: D[_,_,_]` or `case D(_,_,_)`
case D => true
diff --git a/test/files/neg/t5189.check b/test/files/neg/t5189.check
new file mode 100644
index 0000000000..7762f465dc
--- /dev/null
+++ b/test/files/neg/t5189.check
@@ -0,0 +1,6 @@
+t5189.scala:3: error: type mismatch;
+ found : Nothing => Any
+ required: Any => Any
+ def f(x: Any): Any => Any = x match { case Foo(bar) => bar }
+ ^
+one error found \ No newline at end of file
diff --git a/test/files/neg/t5189.scala b/test/files/neg/t5189.scala
new file mode 100644
index 0000000000..19e8e74667
--- /dev/null
+++ b/test/files/neg/t5189.scala
@@ -0,0 +1,5 @@
+class TestNeg1 {
+ case class Foo[T, U](f: T => U)
+ def f(x: Any): Any => Any = x match { case Foo(bar) => bar }
+ // uh-oh, Any => Any should be Nothing => Any.
+}
diff --git a/test/files/neg/t5189b.check b/test/files/neg/t5189b.check
new file mode 100644
index 0000000000..7f78cbb438
--- /dev/null
+++ b/test/files/neg/t5189b.check
@@ -0,0 +1,8 @@
+t5189b.scala:25: error: type mismatch;
+ found : TestNeg.Wrapped[?T2] where type ?T2 <: T
+ required: TestNeg.Wrapped[T]
+Note: ?T2 <: T, but class Wrapped is invariant in type W.
+You may wish to define W as +W instead. (SLS 4.5)
+ case Wrapper/*[_ <: T ]*/(wrapped) => wrapped // : Wrapped[_ <: T], which is a subtype of Wrapped[T] if and only if Wrapped is covariant in its type parameter
+ ^
+one error found
diff --git a/test/files/neg/t5189b.scala b/test/files/neg/t5189b.scala
new file mode 100644
index 0000000000..1750f14084
--- /dev/null
+++ b/test/files/neg/t5189b.scala
@@ -0,0 +1,62 @@
+class TestPos {
+ class AbsWrapperCov[+A]
+ case class Wrapper[B](x: B) extends AbsWrapperCov[B]
+
+ def unwrap[T](x: AbsWrapperCov[T]): T = x match {
+ case Wrapper/*[_ <: T ]*/(x) => x // _ <: T, which is a subtype of T
+ }
+}
+
+object TestNeg extends App {
+ class AbsWrapperCov[+A]
+ case class Wrapper[B](x: Wrapped[B]) extends AbsWrapperCov[B]
+
+ /*
+ when inferring Wrapper's type parameter B from x's type AbsWrapperCov[T],
+ we must take into account that x's actual type is AbsWrapperCov[Tactual] forSome {type Tactual <: T}
+ as AbsWrapperCov is covariant in A -- in other words, we must not assume we know T exactly, all we know is its upper bound
+
+ since method application is the only way to generate this slack between run-time and compile-time types,
+ we'll simply replace the skolems that represent method type parameters as seen from the method's body by
+ other skolems that are (upper/lower)-bounded by the type-parameter skolems
+ (depending on whether the skolem appears in a covariant/contravariant position)
+ */
+ def unwrap[T](x: AbsWrapperCov[T]): Wrapped[T] = x match {
+ case Wrapper/*[_ <: T ]*/(wrapped) => wrapped // : Wrapped[_ <: T], which is a subtype of Wrapped[T] if and only if Wrapped is covariant in its type parameter
+ }
+
+ class Wrapped[W](var cell: W) // must be invariant (to trigger the bug)
+
+ // class A { def imNotAB = println("notB")}
+ // class B
+ //
+ // val w = new Wrapped(new A)
+ // unwrap[Any](Wrapper(w)).cell = new B
+ // w.cell.imNotAB
+}
+
+// class TestPos1 {
+// class Base[T]
+// case class C[T](x: T) extends Base[T]
+// def foo[T](b: Base[T]): T = b match { case C(x) => x }
+//
+// case class Span[K <: Ordered[K]](low: Option[K], high: Option[K]) extends Function1[K, Boolean] {
+// override def equals(x$1: Any): Boolean = x$1 match {
+// case Span((low$0 @ _), (high$0 @ _)) if low$0.equals(low).$amp$amp(high$0.equals(high)) => true
+// case _ => false
+// }
+// def apply(k: K): Boolean = this match {
+// case Span(Some(low), Some(high)) => (k >= low && k <= high)
+// case Span(Some(low), None) => (k >= low)
+// case Span(None, Some(high)) => (k <= high)
+// case _ => false
+// }
+// }
+// }
+//
+// class TestNeg1 {
+// case class Foo[T, U](f: T => U)
+// def f(x: Any): Any => Any = x match { case Foo(bar) => bar }
+// // uh-oh, Any => Any should be Nothing => Any.
+// }
+
diff --git a/test/files/neg/t5358.check b/test/files/neg/t5358.check
new file mode 100644
index 0000000000..59e83bba2f
--- /dev/null
+++ b/test/files/neg/t5358.check
@@ -0,0 +1,7 @@
+t5358.scala:3: error: class C inherits conflicting members:
+ method hi in trait A of type => String and
+ method hi in trait B of type => String
+(Note: this can be resolved by declaring an override in class C.)
+class C extends A with B
+ ^
+one error found
diff --git a/test/files/neg/t5358.scala b/test/files/neg/t5358.scala
new file mode 100644
index 0000000000..13d827ed82
--- /dev/null
+++ b/test/files/neg/t5358.scala
@@ -0,0 +1,4 @@
+trait A { def hi = "A" }
+trait B { def hi = "B" }
+class C extends A with B
+
diff --git a/test/files/neg/t5429.check b/test/files/neg/t5429.check
new file mode 100644
index 0000000000..1b89c59587
--- /dev/null
+++ b/test/files/neg/t5429.check
@@ -0,0 +1,132 @@
+t5429.scala:20: error: overriding value value in class A of type Int;
+ object value needs `override' modifier
+ object value // fail
+ ^
+t5429.scala:21: error: overriding lazy value lazyvalue in class A of type Int;
+ object lazyvalue needs `override' modifier
+ object lazyvalue // fail
+ ^
+t5429.scala:22: error: overriding method nullary in class A of type => Int;
+ object nullary needs `override' modifier
+ object nullary // fail
+ ^
+t5429.scala:23: error: overriding method emptyArg in class A of type ()Int;
+ object emptyArg needs `override' modifier
+ object emptyArg // fail
+ ^
+t5429.scala:27: error: overriding value value in class A0 of type Any;
+ object value needs `override' modifier
+ object value // fail
+ ^
+t5429.scala:28: error: overriding lazy value lazyvalue in class A0 of type Any;
+ object lazyvalue needs `override' modifier
+ object lazyvalue // fail
+ ^
+t5429.scala:29: error: overriding method nullary in class A0 of type => Any;
+ object nullary needs `override' modifier
+ object nullary // fail
+ ^
+t5429.scala:30: error: overriding method emptyArg in class A0 of type ()Any;
+ object emptyArg needs `override' modifier
+ object emptyArg // fail
+ ^
+t5429.scala:35: error: overriding value value in class A of type Int;
+ object value has incompatible type
+ override object value // fail
+ ^
+t5429.scala:36: error: overriding lazy value lazyvalue in class A of type Int;
+ object lazyvalue must be declared lazy to override a concrete lazy value
+ override object lazyvalue // fail
+ ^
+t5429.scala:37: error: overriding method nullary in class A of type => Int;
+ object nullary has incompatible type
+ override object nullary // fail
+ ^
+t5429.scala:38: error: overriding method emptyArg in class A of type ()Int;
+ object emptyArg has incompatible type
+ override object emptyArg // fail
+ ^
+t5429.scala:39: error: object oneArg overrides nothing
+ override object oneArg // fail
+ ^
+t5429.scala:43: error: overriding lazy value lazyvalue in class A0 of type Any;
+ object lazyvalue must be declared lazy to override a concrete lazy value
+ override object lazyvalue // !!! this fails, but should succeed (lazy over lazy)
+ ^
+t5429.scala:46: error: object oneArg overrides nothing
+ override object oneArg // fail
+ ^
+t5429.scala:50: error: overriding value value in class A of type Int;
+ value value needs `override' modifier
+ val value = 0 // fail
+ ^
+t5429.scala:51: error: overriding lazy value lazyvalue in class A of type Int;
+ value lazyvalue needs `override' modifier
+ val lazyvalue = 0 // fail
+ ^
+t5429.scala:52: error: overriding method nullary in class A of type => Int;
+ value nullary needs `override' modifier
+ val nullary = 5 // fail
+ ^
+t5429.scala:53: error: overriding method emptyArg in class A of type ()Int;
+ value emptyArg needs `override' modifier
+ val emptyArg = 10 // fail
+ ^
+t5429.scala:58: error: overriding lazy value lazyvalue in class A0 of type Any;
+ value lazyvalue must be declared lazy to override a concrete lazy value
+ override val lazyvalue = 0 // fail (non-lazy)
+ ^
+t5429.scala:61: error: value oneArg overrides nothing
+ override val oneArg = 15 // fail
+ ^
+t5429.scala:65: error: overriding value value in class A of type Int;
+ method value needs `override' modifier
+ def value = 0 // fail
+ ^
+t5429.scala:66: error: overriding lazy value lazyvalue in class A of type Int;
+ method lazyvalue needs `override' modifier
+ def lazyvalue = 2 // fail
+ ^
+t5429.scala:67: error: overriding method nullary in class A of type => Int;
+ method nullary needs `override' modifier
+ def nullary = 5 // fail
+ ^
+t5429.scala:68: error: overriding method emptyArg in class A of type ()Int;
+ method emptyArg needs `override' modifier
+ def emptyArg = 10 // fail
+ ^
+t5429.scala:72: error: overriding value value in class A0 of type Any;
+ method value needs to be a stable, immutable value
+ override def value = 0 // fail
+ ^
+t5429.scala:73: error: overriding lazy value lazyvalue in class A0 of type Any;
+ method lazyvalue needs to be a stable, immutable value
+ override def lazyvalue = 2 // fail
+ ^
+t5429.scala:76: error: method oneArg overrides nothing
+ override def oneArg = 15 // fail
+ ^
+t5429.scala:80: error: overriding value value in class A of type Int;
+ lazy value value needs `override' modifier
+ lazy val value = 0 // fail
+ ^
+t5429.scala:81: error: overriding lazy value lazyvalue in class A of type Int;
+ lazy value lazyvalue needs `override' modifier
+ lazy val lazyvalue = 2 // fail
+ ^
+t5429.scala:82: error: overriding method nullary in class A of type => Int;
+ lazy value nullary needs `override' modifier
+ lazy val nullary = 5 // fail
+ ^
+t5429.scala:83: error: overriding method emptyArg in class A of type ()Int;
+ lazy value emptyArg needs `override' modifier
+ lazy val emptyArg = 10 // fail
+ ^
+t5429.scala:87: error: overriding value value in class A0 of type Any;
+ lazy value value cannot override a concrete non-lazy value
+ override lazy val value = 0 // fail (strict over lazy)
+ ^
+t5429.scala:91: error: value oneArg overrides nothing
+ override lazy val oneArg = 15 // fail
+ ^
+34 errors found
diff --git a/test/files/neg/t5429.scala b/test/files/neg/t5429.scala
new file mode 100644
index 0000000000..1cd4dcd032
--- /dev/null
+++ b/test/files/neg/t5429.scala
@@ -0,0 +1,93 @@
+// /scala/trac/5429/a.scala
+// Wed Feb 1 08:05:27 PST 2012
+
+class A {
+ val value = 0
+ lazy val lazyvalue = 2
+ def nullary = 5
+ def emptyArg() = 10
+ def oneArg(x: String) = 15
+}
+class A0 {
+ val value: Any = 0
+ lazy val lazyvalue: Any = 2
+ def nullary: Any = 5
+ def emptyArg(): Any = 10
+ def oneArg(x: String): Any = 15
+}
+
+class B extends A {
+ object value // fail
+ object lazyvalue // fail
+ object nullary // fail
+ object emptyArg // fail
+ object oneArg // overload
+}
+class B0 extends A0 {
+ object value // fail
+ object lazyvalue // fail
+ object nullary // fail
+ object emptyArg // fail
+ object oneArg // overload
+}
+
+class C extends A {
+ override object value // fail
+ override object lazyvalue // fail
+ override object nullary // fail
+ override object emptyArg // fail
+ override object oneArg // fail
+}
+class C0 extends A0 {
+ override object value // !!! this succeeds, but should fail (lazy over strict)
+ override object lazyvalue // !!! this fails, but should succeed (lazy over lazy)
+ override object nullary // override
+ override object emptyArg // override
+ override object oneArg // fail
+}
+
+class D extends A {
+ val value = 0 // fail
+ val lazyvalue = 0 // fail
+ val nullary = 5 // fail
+ val emptyArg = 10 // fail
+ val oneArg = 15 // overload
+}
+class D0 extends A0 {
+ override val value = 0 // override
+ override val lazyvalue = 0 // fail (non-lazy)
+ override val nullary = 5 // override
+ override val emptyArg = 10 // override
+ override val oneArg = 15 // fail
+}
+
+class E extends A {
+ def value = 0 // fail
+ def lazyvalue = 2 // fail
+ def nullary = 5 // fail
+ def emptyArg = 10 // fail
+ def oneArg = 15 // overload
+}
+class E0 extends A0 {
+ override def value = 0 // fail
+ override def lazyvalue = 2 // fail
+ override def nullary = 5 // override
+ override def emptyArg = 10 // override
+ override def oneArg = 15 // fail
+}
+
+class F extends A {
+ lazy val value = 0 // fail
+ lazy val lazyvalue = 2 // fail
+ lazy val nullary = 5 // fail
+ lazy val emptyArg = 10 // fail
+ lazy val oneArg = 15 // overload
+}
+class F0 extends A0 {
+ override lazy val value = 0 // fail (strict over lazy)
+ override lazy val lazyvalue = 2 // override (lazy over lazy)
+ override lazy val nullary = 5 // override
+ override lazy val emptyArg = 10 // override
+ override lazy val oneArg = 15 // fail
+}
+
diff --git a/test/files/neg/t5452.check b/test/files/neg/t5452.check
new file mode 100644
index 0000000000..2f35a45509
--- /dev/null
+++ b/test/files/neg/t5452.check
@@ -0,0 +1,8 @@
+t5452.scala:28: error: overloaded method value apply with alternatives:
+ ()Queryable[CoffeesTable] <and>
+ (t: Tree)(implicit evidence$2: Manifest[CoffeesTable])Nothing <and>
+ (implicit evidence$1: Manifest[CoffeesTable])Nothing
+ cannot be applied to (Queryable[CoffeesTable])
+ Queryable[CoffeesTable]( q.treeFilter(null) )
+ ^
+one error found
diff --git a/test/files/neg/t5452.scala b/test/files/neg/t5452.scala
new file mode 100644
index 0000000000..1032db7a4b
--- /dev/null
+++ b/test/files/neg/t5452.scala
@@ -0,0 +1,29 @@
+// /scala/trac/5452/a.scala
+// Mon Feb 13 22:52:36 PST 2012
+
+// import scala.reflect.mirror._
+
+trait Tree
+
+object Bip {
+ def ??? = sys.error("")
+}
+import Bip._
+
+case class Queryable[T]() {
+ def treeFilter( t:Tree ) : Queryable[T] = ???
+}
+
+object Queryable {
+ def apply[T:Manifest] = ???
+ def apply[T:Manifest]( t:Tree ) = ???
+}
+
+trait CoffeesTable{
+ def sales : Int
+}
+
+object Test extends App{
+ val q = new Queryable[CoffeesTable]
+ Queryable[CoffeesTable]( q.treeFilter(null) )
+}
diff --git a/test/files/neg/t5455.check b/test/files/neg/t5455.check
new file mode 100644
index 0000000000..788daf99fa
--- /dev/null
+++ b/test/files/neg/t5455.check
@@ -0,0 +1,4 @@
+t5455.scala:4: error: lazy vals are not tailcall transformed
+ @annotation.tailrec final lazy val bar: Thing[Int] = {
+ ^
+one error found
diff --git a/test/files/neg/t5455.scala b/test/files/neg/t5455.scala
new file mode 100644
index 0000000000..22d6c442c9
--- /dev/null
+++ b/test/files/neg/t5455.scala
@@ -0,0 +1,16 @@
+trait Test {
+ def root: Test
+
+ @annotation.tailrec final lazy val bar: Thing[Int] = {
+ if (this eq root)
+ Thing(() => System.identityHashCode(bar))
+ else
+ root.bar
+ }
+
+ def f = bar.f()
+}
+
+case class Thing[A](f: () => A) {
+ override def toString = "" + f()
+}
diff --git a/test/files/neg/t5493.check b/test/files/neg/t5493.check
new file mode 100644
index 0000000000..78b1536bc7
--- /dev/null
+++ b/test/files/neg/t5493.check
@@ -0,0 +1,4 @@
+t5493.scala:2: error: not found: value iDontExist
+ def meh(xs: Any): Any = xs :: iDontExist :: Nil
+ ^
+one error found
diff --git a/test/files/neg/t5493.scala b/test/files/neg/t5493.scala
new file mode 100644
index 0000000000..459cf53bbd
--- /dev/null
+++ b/test/files/neg/t5493.scala
@@ -0,0 +1,3 @@
+object Test {
+ def meh(xs: Any): Any = xs :: iDontExist :: Nil
+}
diff --git a/test/files/neg/t5497.check b/test/files/neg/t5497.check
new file mode 100644
index 0000000000..fef6d38da0
--- /dev/null
+++ b/test/files/neg/t5497.check
@@ -0,0 +1,4 @@
+t5497.scala:3: error: not found: value sq
+ case other => println(null.asInstanceOf[sq.Filter].tableName)
+ ^
+one error found
diff --git a/test/files/neg/t5497.scala b/test/files/neg/t5497.scala
new file mode 100644
index 0000000000..40d47de12d
--- /dev/null
+++ b/test/files/neg/t5497.scala
@@ -0,0 +1,5 @@
+object TestQueryable extends App{
+ ({
+ case other => println(null.asInstanceOf[sq.Filter].tableName)
+ } : Any => Unit)(null)
+}
diff --git a/test/files/neg/t5529.check b/test/files/neg/t5529.check
new file mode 100644
index 0000000000..78a26aeb50
--- /dev/null
+++ b/test/files/neg/t5529.check
@@ -0,0 +1,12 @@
+t5529.scala:12: error: File is already defined as class File
+ type File
+ ^
+t5529.scala:10: error: class type required but test.Test.File found
+ sealed class Dir extends File { }
+ ^
+t5529.scala:10: error: illegal inheritance; super<none>
+ is not a subclass of the superclass Object
+ of the mixin trait ScalaObject
+ sealed class Dir extends File { }
+ ^
+three errors found
diff --git a/test/files/neg/t5529.scala b/test/files/neg/t5529.scala
new file mode 100644
index 0000000000..033009a8a6
--- /dev/null
+++ b/test/files/neg/t5529.scala
@@ -0,0 +1,13 @@
+// /scala/trac/5529/a.scala
+// Tue Feb 28 13:11:28 PST 2012
+
+package test;
+
+object Test {
+ sealed class File {
+ val i = 1
+ }
+ sealed class Dir extends File { }
+
+ type File
+}
diff --git a/test/files/neg/t5553_1.check b/test/files/neg/t5553_1.check
new file mode 100644
index 0000000000..afd6489888
--- /dev/null
+++ b/test/files/neg/t5553_1.check
@@ -0,0 +1,54 @@
+t5553_1.scala:18: error: ambiguous reference to overloaded definition,
+both method apply in object Foo1 of type (z: String)Base[T]
+and method apply in object Foo1 of type (a: Int)Base[T]
+match expected type ?
+ def test1[T] = Foo1[T]
+ ^
+t5553_1.scala:19: error: type mismatch;
+ found : [T](z: String)Base[T] <and> (a: Int)Base[T]
+ required: Int
+ def test2[T]: Int = Foo1[T]
+ ^
+t5553_1.scala:20: error: type mismatch;
+ found : [T(in method apply)](z: String)Base[T(in method apply)] <and> (a: Int)Base[T(in method apply)]
+ required: Base[T(in method test3)]
+ def test3[T]: Base[T] = Foo1[T]
+ ^
+t5553_1.scala:24: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (z: String)Base[T]
+and method apply in object Foo2 of type (a: Int)Base[T]
+match expected type ?
+ def test4[T] = Foo2[T]
+ ^
+t5553_1.scala:25: error: type mismatch;
+ found : [T](z: String)Base[T] <and> (a: Int)Base[T]
+ required: Int
+ def test5[T]: Int = Foo2[T]
+ ^
+t5553_1.scala:26: error: type mismatch;
+ found : [T(in method apply)](z: String)Base[T(in method apply)] <and> (a: Int)Base[T(in method apply)]
+ required: Base[T(in method test6)]
+ def test6[T]: Base[T] = Foo2[T]
+ ^
+t5553_1.scala:30: error: ambiguous reference to overloaded definition,
+both method apply in object Foo3 of type (z: String)String
+and method apply in object Foo3 of type (a: Int)Base[T]
+match expected type ?
+ def test7[T] = Foo3[T]
+ ^
+t5553_1.scala:31: error: type mismatch;
+ found : [T](z: String)String <and> (a: Int)Base[T]
+ required: String
+ def test8[T]: String = Foo3[T]
+ ^
+t5553_1.scala:32: error: type mismatch;
+ found : [T](z: String)String <and> (a: Int)Base[T]
+ required: Int
+ def test9[T]: Int = Foo3[T]
+ ^
+t5553_1.scala:33: error: type mismatch;
+ found : [T(in method apply)](z: String)String <and> (a: Int)Base[T(in method apply)]
+ required: Base[T(in method test10)]
+ def test10[T]: Base[T] = Foo3[T]
+ ^
+10 errors found
diff --git a/test/files/neg/t5553_1.scala b/test/files/neg/t5553_1.scala
new file mode 100644
index 0000000000..32d61ec852
--- /dev/null
+++ b/test/files/neg/t5553_1.scala
@@ -0,0 +1,34 @@
+class Base[T]
+
+object Foo1 {
+ def apply[T](a: Int): Base[T] = new Base[T]
+ def apply[T](z: String): Base[T] = new Base[T]
+}
+
+object Foo2 {
+ def apply[T](a: Int): Base[T] = new Base[T]
+ def apply[T](z: String="abc"): Base[T] = new Base[T]
+}
+
+object Foo3 {
+ def apply[T](a: Int): Base[T] = new Base[T]
+ def apply[T](z: String="abc"): String = z
+}
+object Test {
+ def test1[T] = Foo1[T]
+ def test2[T]: Int = Foo1[T]
+ def test3[T]: Base[T] = Foo1[T]
+}
+
+object Test2 {
+ def test4[T] = Foo2[T]
+ def test5[T]: Int = Foo2[T]
+ def test6[T]: Base[T] = Foo2[T]
+}
+
+object Test3{
+ def test7[T] = Foo3[T]
+ def test8[T]: String = Foo3[T]
+ def test9[T]: Int = Foo3[T]
+ def test10[T]: Base[T] = Foo3[T]
+}
diff --git a/test/files/neg/t5553_2.check b/test/files/neg/t5553_2.check
new file mode 100644
index 0000000000..599fdb0523
--- /dev/null
+++ b/test/files/neg/t5553_2.check
@@ -0,0 +1,50 @@
+t5553_2.scala:27: error: type mismatch;
+ found : Base[T]
+ required: Int
+ def test4[T]: Int = Foo1[T](1)
+ ^
+t5553_2.scala:34: error: type mismatch;
+ found : String
+ required: Base[T]
+ def test7[T]: Base[T] = Foo2[T]
+ ^
+t5553_2.scala:35: error: type mismatch;
+ found : String
+ required: Int
+ def test8[T]: Int = Foo2[T]
+ ^
+t5553_2.scala:40: error: type mismatch;
+ found : String
+ required: Int
+ def test9[T]: Int = Foo3[T]
+ ^
+t5553_2.scala:41: error: type mismatch;
+ found : String
+ required: Base[T]
+ def test10[T]: Base[T] = Foo3[T]
+ ^
+t5553_2.scala:47: error: could not find implicit value for parameter z: String
+ def test13[T]: Int = Foo3[T]
+ ^
+t5553_2.scala:48: error: could not find implicit value for parameter z: String
+ def test14[T]: Base[T] = Foo3[T]
+ ^
+t5553_2.scala:49: error: could not find implicit value for parameter z: String
+ def test15[T]: String = Foo3[T]
+ ^
+t5553_2.scala:50: error: could not find implicit value for parameter z: String
+ def test16[T] = Foo3[T]
+ ^
+t5553_2.scala:54: error: ambiguous reference to overloaded definition,
+both method apply in object Foo4 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo4 of type (x: Int)Base[T]
+match argument types (Int)
+ def test17[T] = Foo4[T](1)
+ ^
+t5553_2.scala:55: error: ambiguous reference to overloaded definition,
+both method apply in object Foo4 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo4 of type (x: Int)Base[T]
+match argument types (Int) and expected result type Base[T]
+ def test18[T]: Base[T] = Foo4[T](1)
+ ^
+11 errors found
diff --git a/test/files/neg/t5553_2.scala b/test/files/neg/t5553_2.scala
new file mode 100644
index 0000000000..16958aec8e
--- /dev/null
+++ b/test/files/neg/t5553_2.scala
@@ -0,0 +1,59 @@
+class Base[T]
+
+object Foo1 {
+ def apply[T](x: Int): Base[T] = new Base[T]
+ def apply[T](x: Int, z: String="abc"): String = z
+}
+
+object Foo2 {
+ def apply[T](a: Int): Base[T] = new Base[T]
+ def apply[T]: String = "abc"
+}
+
+object Foo3 {
+ def apply[T](x: Int): Base[T] = new Base[T]
+ def apply[T](implicit z: String): String = z
+}
+
+object Foo4 {
+ def apply[T](x: Int): Base[T] = new Base[T]
+ def apply[T](x: Int)(implicit z: String): Base[T] = new Base[T]
+}
+
+object Test1 {
+ def test1[T] = Foo1[T](1)
+ def test2[T]: String = Foo1[T](1)
+ def test3[T]: Base[T] = Foo1[T](1)
+ def test4[T]: Int = Foo1[T](1)
+
+}
+
+object Test2 {
+ def test5[T] = Foo2[T]
+ def test6[T]: String = Foo2[T]
+ def test7[T]: Base[T] = Foo2[T]
+ def test8[T]: Int = Foo2[T]
+}
+
+object Test3 {
+ implicit val v: String = "abc"
+ def test9[T]: Int = Foo3[T]
+ def test10[T]: Base[T] = Foo3[T]
+ def test11[T]: String = Foo3[T]
+ def test12[T] = Foo3[T]
+}
+
+object Test4 {
+ def test13[T]: Int = Foo3[T]
+ def test14[T]: Base[T] = Foo3[T]
+ def test15[T]: String = Foo3[T]
+ def test16[T] = Foo3[T]
+}
+
+object Test5 {
+ def test17[T] = Foo4[T](1)
+ def test18[T]: Base[T] = Foo4[T](1)
+ //def test19[T]: String = Foo4[T](1) // #5554
+}
+
+
diff --git a/test/files/neg/t5554.check b/test/files/neg/t5554.check
new file mode 100644
index 0000000000..8f657fd32f
--- /dev/null
+++ b/test/files/neg/t5554.check
@@ -0,0 +1,67 @@
+t5554.scala:14: error: ambiguous reference to overloaded definition,
+both method apply in object Foo1 of type (x: Int)(implicit z: String)String
+and method apply in object Foo1 of type (x: Int)Base[T]
+match argument types (Int)
+ def test1[T]: Int = Foo1[T](1)
+ ^
+t5554.scala:16: error: ambiguous reference to overloaded definition,
+both method apply in object Foo1 of type (x: Int)(implicit z: String)String
+and method apply in object Foo1 of type (x: Int)Base[T]
+match argument types (Int)
+ def test3[T]: String = Foo1[T](1)
+ ^
+t5554.scala:17: error: ambiguous reference to overloaded definition,
+both method apply in object Foo1 of type (x: Int)(implicit z: String)String
+and method apply in object Foo1 of type (x: Int)Base[T]
+match argument types (Int)
+ def test4[T] = Foo1[T](1)
+ ^
+t5554.scala:22: error: ambiguous reference to overloaded definition,
+both method apply in object Foo1 of type (x: Int)(implicit z: String)String
+and method apply in object Foo1 of type (x: Int)Base[T]
+match argument types (Int)
+ def test5[T]: Int = Foo1[T](1)
+ ^
+t5554.scala:25: error: ambiguous reference to overloaded definition,
+both method apply in object Foo1 of type (x: Int)(implicit z: String)String
+and method apply in object Foo1 of type (x: Int)Base[T]
+match argument types (Int)
+ def test8[T] = Foo1[T](1)
+ ^
+t5554.scala:29: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo2 of type (x: Int)Base[T]
+match argument types (Int)
+ def test9[T]: String = Foo2[T](1)
+ ^
+t5554.scala:30: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo2 of type (x: Int)Base[T]
+match argument types (Int) and expected result type Base[T]
+ def test10[T]: Base[T] = Foo2[T](1)
+ ^
+t5554.scala:31: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo2 of type (x: Int)Base[T]
+match argument types (Int)
+ def test11[T] = Foo2[T](1)
+ ^
+t5554.scala:36: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo2 of type (x: Int)Base[T]
+match argument types (Int)
+ def test12[T]: String = Foo2[T](1)
+ ^
+t5554.scala:37: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo2 of type (x: Int)Base[T]
+match argument types (Int) and expected result type Base[T]
+ def test13[T]: Base[T] = Foo2[T](1)
+ ^
+t5554.scala:38: error: ambiguous reference to overloaded definition,
+both method apply in object Foo2 of type (x: Int)(implicit z: String)Base[T]
+and method apply in object Foo2 of type (x: Int)Base[T]
+match argument types (Int)
+ def test14[T] = Foo2[T](1)
+ ^
+11 errors found
diff --git a/test/files/neg/t5554.scala b/test/files/neg/t5554.scala
new file mode 100644
index 0000000000..d279abea7f
--- /dev/null
+++ b/test/files/neg/t5554.scala
@@ -0,0 +1,39 @@
+class Base[T]
+
+object Foo1 {
+ def apply[T](x: Int): Base[T] = new Base[T]
+ def apply[T](x: Int)(implicit z: String): String = z
+}
+
+object Foo2 {
+ def apply[T](x: Int): Base[T] = new Base[T]
+ def apply[T](x: Int)(implicit z: String): Base[T] = new Base[T]
+}
+
+object Test1 {
+ def test1[T]: Int = Foo1[T](1)
+ def test2[T]: Base[T] = Foo1[T](1)
+ def test3[T]: String = Foo1[T](1)
+ def test4[T] = Foo1[T](1)
+}
+
+object Test2 {
+ implicit val v: String = "foo"
+ def test5[T]: Int = Foo1[T](1)
+ def test6[T]: Base[T] = Foo1[T](1)
+ def test7[T]: String = Foo1[T](1)
+ def test8[T] = Foo1[T](1)
+}
+
+object Test3 {
+ def test9[T]: String = Foo2[T](1)
+ def test10[T]: Base[T] = Foo2[T](1)
+ def test11[T] = Foo2[T](1)
+}
+
+object Test4 {
+ implicit val v: String = "foo"
+ def test12[T]: String = Foo2[T](1)
+ def test13[T]: Base[T] = Foo2[T](1)
+ def test14[T] = Foo2[T](1)
+}
diff --git a/test/files/neg/t591.check b/test/files/neg/t591.check
index 434c2dd002..5cdeebf079 100644
--- a/test/files/neg/t591.check
+++ b/test/files/neg/t591.check
@@ -1,4 +1,4 @@
-t591.scala:38: error: method input_= is defined twice
+t591.scala:38: error: method input_= is defined twice in t591.scala
def input_=(in : Input) = {}
^
one error found
diff --git a/test/files/neg/t800.check b/test/files/neg/t800.check
index 4bfba5420b..44c316a95b 100644
--- a/test/files/neg/t800.check
+++ b/test/files/neg/t800.check
@@ -1,13 +1,13 @@
t800.scala:4: error: qualification is already defined as value qualification
val qualification = false;
^
-t800.scala:8: error: method qualification is defined twice
+t800.scala:8: error: method qualification is defined twice in t800.scala
val qualification = false;
^
-t800.scala:12: error: value qualification is defined twice
+t800.scala:12: error: value qualification is defined twice in t800.scala
var qualification = false;
^
-t800.scala:16: error: method qualification is defined twice
+t800.scala:16: error: method qualification is defined twice in t800.scala
var qualification = false;
^
four errors found
diff --git a/test/files/neg/t935.check b/test/files/neg/t935.check
index af634a2630..8b73700187 100644
--- a/test/files/neg/t935.check
+++ b/test/files/neg/t935.check
@@ -4,4 +4,7 @@ t935.scala:7: error: type arguments [Test3.B] do not conform to class E's type p
t935.scala:13: error: type arguments [Test4.B] do not conform to class E's type parameter bounds [T <: String]
val b: String @E[B](new B) = "hi"
^
-two errors found
+t935.scala:13: error: type arguments [Test4.B] do not conform to class E's type parameter bounds [T <: String]
+ val b: String @E[B](new B) = "hi"
+ ^
+three errors found
diff --git a/test/files/neg/t960.check b/test/files/neg/t960.check
index d65b0cea93..603b1cb032 100644
--- a/test/files/neg/t960.check
+++ b/test/files/neg/t960.check
@@ -4,7 +4,10 @@ and method unapply in object List of type [a](xs: List[a])Option[(a, List[a])]
match argument types (List[a])
case List(x, xs) => 7
^
-t960.scala:12: error: method unapply is defined twice
+t960.scala:22: error: cannot resolve overloaded unapply
+ case List(x, xs) => 7
+ ^
+t960.scala:12: error: method unapply is defined twice in t960.scala
def unapply[a](xs: List[a]): Option[Null] = xs match {
^
-two errors found
+three errors found
diff --git a/test/files/neg/t960.scala b/test/files/neg/t960.scala
index 5101cf8433..36909626c1 100644
--- a/test/files/neg/t960.scala
+++ b/test/files/neg/t960.scala
@@ -17,4 +17,8 @@ object List {
def foo[a](xs: List[a]) = xs match {
case List(x, xs) => 7
}
+
+ def bar(xs: Any) = xs match { // test error message OverloadedUnapplyError
+ case List(x, xs) => 7
+ }
}
diff --git a/test/files/neg/tailrec-2.check b/test/files/neg/tailrec-2.check
index 4f763a1c8d..a918858773 100644
--- a/test/files/neg/tailrec-2.check
+++ b/test/files/neg/tailrec-2.check
@@ -1,4 +1,7 @@
-tailrec-2.scala:6: error: could not optimize @tailrec annotated method f: it contains a recursive call targetting a supertype
+tailrec-2.scala:8: error: could not optimize @tailrec annotated method f: it contains a recursive call targetting a supertype
@annotation.tailrec final def f[B >: A](mem: List[B]): List[B] = (null: Super[A]).f(mem)
^
-one error found
+tailrec-2.scala:9: error: @tailrec annotated method contains no recursive calls
+ @annotation.tailrec final def f1[B >: A](mem: List[B]): List[B] = this.g(mem)
+ ^
+two errors found
diff --git a/test/files/neg/tailrec-2.scala b/test/files/neg/tailrec-2.scala
index 342cd85323..9eb3af2f07 100644
--- a/test/files/neg/tailrec-2.scala
+++ b/test/files/neg/tailrec-2.scala
@@ -1,9 +1,12 @@
sealed abstract class Super[+A] {
def f[B >: A](mem: List[B]) : List[B]
+ def g(mem: List[_]) = ???
}
// This one should fail, target is a supertype
class Bop1[+A](val element: A) extends Super[A] {
+
@annotation.tailrec final def f[B >: A](mem: List[B]): List[B] = (null: Super[A]).f(mem)
+ @annotation.tailrec final def f1[B >: A](mem: List[B]): List[B] = this.g(mem)
}
// These succeed
class Bop2[+A](val element: A) extends Super[A] {