summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert.plociniczak@gmail.com>2012-01-25 11:33:53 +0100
committerHubert Plociniczak <hubert.plociniczak@gmail.com>2012-01-25 11:33:53 +0100
commitc800d1fec5241ed8c29e5af30465856f9b583246 (patch)
treea37c194bb2d632adf9adeda17a107913f63864ba /test/files
parentde2b0c68785afc0f801fbe8d2750366e90c9fa70 (diff)
downloadscala-c800d1fec5241ed8c29e5af30465856f9b583246.tar.gz
scala-c800d1fec5241ed8c29e5af30465856f9b583246.tar.bz2
scala-c800d1fec5241ed8c29e5af30465856f9b583246.zip
Use context for buffering errors that cannot/shouldn't be reported in the given moment (instead of throwing type errors). This avoids previous problems where we were creating fake error trees in some incorrect places like in type completers in Namers etc. Implicits relied heavily on type errors being thrown but performance should stay the same due to some explicit checks/returns.
Some of the problems involved how ambiguous error messages were collected/reported because it was very random (similarly for divergent implicits). This should be more explicit now. Reduced the number of unnecessary cyclic references being thrown (apart from those in Symbols/Types which don't have a context and need to stay for now as is). Review by @paulp, @odersky.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/buildmanager/t2790/t2790.check1
-rw-r--r--test/files/neg/sensitive2.check10
-rw-r--r--test/files/neg/sensitive2.scala8
-rw-r--r--test/files/neg/t1878.check5
-rw-r--r--test/files/neg/t2641.check20
-rw-r--r--test/files/neg/t2918.check6
-rwxr-xr-xtest/files/neg/t2918.scala2
-rw-r--r--test/files/neg/t3015.check7
-rw-r--r--test/files/neg/t649.check2
9 files changed, 30 insertions, 31 deletions
diff --git a/test/files/buildmanager/t2790/t2790.check b/test/files/buildmanager/t2790/t2790.check
index 4e41db4e49..13d61dac42 100644
--- a/test/files/buildmanager/t2790/t2790.check
+++ b/test/files/buildmanager/t2790/t2790.check
@@ -9,6 +9,5 @@ compiling Set(B.scala)
B.scala:2: error: type mismatch;
found : Int(5)
required: String
-Error occurred in an application involving default arguments.
val y = A.x(5)
^
diff --git a/test/files/neg/sensitive2.check b/test/files/neg/sensitive2.check
new file mode 100644
index 0000000000..19152fe188
--- /dev/null
+++ b/test/files/neg/sensitive2.check
@@ -0,0 +1,10 @@
+sensitive2.scala:6: error: type mismatch;
+ found : String("abc")
+ required: Test.Foo[_]
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method foo1 in object Test of type [A](a: A)Test.Foo[A]
+ and method foo2 in object Test of type (a: Any)Test.Foo[String]
+ are possible conversion functions from String("abc") to Test.Foo[_]
+ val a: Foo[_] = "abc"
+ ^
+one error found
diff --git a/test/files/neg/sensitive2.scala b/test/files/neg/sensitive2.scala
new file mode 100644
index 0000000000..92b91bef20
--- /dev/null
+++ b/test/files/neg/sensitive2.scala
@@ -0,0 +1,8 @@
+object Test {
+ class Foo[A](z: A)
+ implicit def foo1[A](a: A): Foo[A] = new Foo(a)
+ implicit def foo2(a: Any): Foo[String] = new Foo("123")
+
+ val a: Foo[_] = "abc"
+
+} \ No newline at end of file
diff --git a/test/files/neg/t1878.check b/test/files/neg/t1878.check
index f3a6701d41..128741a022 100644
--- a/test/files/neg/t1878.check
+++ b/test/files/neg/t1878.check
@@ -6,10 +6,13 @@ t1878.scala:3: error: scrutinee is incompatible with pattern type;
required: String
val err1 = "" match { case Seq(f @ _*, ',') => f }
^
+t1878.scala:3: error: not found: value f
+ val err1 = "" match { case Seq(f @ _*, ',') => f }
+ ^
t1878.scala:9: error: _* may only come last
val List(List(_*, arg2), _) = List(List(1,2,3), List(4,5,6))
^
t1878.scala:13: error: _* may only come last
case <p> { _* } </p> =>
^
-four errors found
+5 errors found
diff --git a/test/files/neg/t2641.check b/test/files/neg/t2641.check
index 2056a1b9ab..9e2f02ac47 100644
--- a/test/files/neg/t2641.check
+++ b/test/files/neg/t2641.check
@@ -1,4 +1,4 @@
-t2641.scala:18: error: illegal cyclic reference involving trait ManagedSeq
+t2641.scala:18: error: wrong number of type arguments for ManagedSeq, should be 2
with TraversableViewLike[A, ManagedSeqStrict[A], ManagedSeq[A]]
^
t2641.scala:16: error: illegal inheritance;
@@ -13,23 +13,7 @@ t2641.scala:16: error: illegal inheritance;
self-type ManagedSeq does not conform to ScalaObject's selftype ScalaObject
extends ManagedSeqStrict[A]
^
-t2641.scala:24: error: something is wrong (wrong class file?): trait ManagedSeq with type parameters [A,Coll] gets applied to arguments [], phase = typer
- trait Transformed[+B] extends ManagedSeq[B, Coll] with super.Transformed[B]
- ^
-t2641.scala:26: error: something is wrong (wrong class file?): trait ManagedSeq with type parameters [A,Coll] gets applied to arguments [], phase = namer
- trait Sliced extends Transformed[A] with super.Sliced {
- ^
-t2641.scala:26: error: illegal inheritance; superclass Any
- is not a subclass of the superclass ManagedSeqStrict
- of the mixin trait Transformed
- trait Sliced extends Transformed[A] with super.Sliced {
- ^
-t2641.scala:26: error: illegal inheritance; superclass Any
- is not a subclass of the superclass Object
- of the mixin trait Sliced
- trait Sliced extends Transformed[A] with super.Sliced {
- ^
t2641.scala:27: error: value managedIterator is not a member of ManagedSeq
override def managedIterator = self.managedIterator slice (from, until)
^
-9 errors found
+5 errors found
diff --git a/test/files/neg/t2918.check b/test/files/neg/t2918.check
index 263beab518..aae3045e8a 100644
--- a/test/files/neg/t2918.check
+++ b/test/files/neg/t2918.check
@@ -1,10 +1,10 @@
t2918.scala:2: error: illegal cyclic reference involving type A
- def g[X, A[X] <: A[X]](x: A[X]) = x
+ def g[X, A[X] <: A[X]](x: A[X]) = x
^
t2918.scala:2: error: cyclic aliasing or subtyping involving type A
- def g[X, A[X] <: A[X]](x: A[X]) = x
+ def g[X, A[X] <: A[X]](x: A[X]) = x
^
t2918.scala:2: error: A does not take type parameters
- def g[X, A[X] <: A[X]](x: A[X]) = x
+ def g[X, A[X] <: A[X]](x: A[X]) = x
^
three errors found
diff --git a/test/files/neg/t2918.scala b/test/files/neg/t2918.scala
index 03477ccfbf..ff2be39ae0 100755
--- a/test/files/neg/t2918.scala
+++ b/test/files/neg/t2918.scala
@@ -1,3 +1,3 @@
object Test {
- def g[X, A[X] <: A[X]](x: A[X]) = x
+ def g[X, A[X] <: A[X]](x: A[X]) = x
}
diff --git a/test/files/neg/t3015.check b/test/files/neg/t3015.check
index 0b394e23d6..53221b7ca0 100644
--- a/test/files/neg/t3015.check
+++ b/test/files/neg/t3015.check
@@ -3,9 +3,4 @@ t3015.scala:7: error: scrutinee is incompatible with pattern type;
required: String
val b(foo) = "foo"
^
-t3015.scala:7: error: type mismatch;
- found : String with _$1(in object Test) where type +_$1(in object Test)
- required: (some other)_$1(in object Test) where type +(some other)_$1(in object Test)
- val b(foo) = "foo"
- ^
-two errors found
+one error found
diff --git a/test/files/neg/t649.check b/test/files/neg/t649.check
index 5a270d4751..a6670886b5 100644
--- a/test/files/neg/t649.check
+++ b/test/files/neg/t649.check
@@ -1,4 +1,4 @@
t649.scala:3: error: overloaded method foo needs result type
def foo[A] = foo[A]
- ^
+ ^
one error found