From 620f339bbaadad57daa696007660bb887372e927 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Wed, 7 Sep 2011 12:17:54 +0000 Subject: First refactoring related to Error trees. There are no more direct calls to context.error from Typers and Infer, so more work needs to be done to finish it for Implicits and Namers. I am pushing it to trunk so that all of you can share my pain (and complain). Please do not add any more context.error randomly in that code, instead deal with it appropriately (by creating specific error tree). I was trying to be as informative when it comes to error tree names as possible, but if you feel like changing names to something more appropriate then feel free to do so. When it comes to printing error messages I tried to follow test suite as closily as possible but obviously there were few changes to some tests (mostly positive, I believe). On my machine performance drawback was neglible but I am working on more aggressive caching to reduce the penalty of containsError() calls even more. Any suggestions welcome. At the moment the code supports both styles i.e. throwing type errors for the cases that are not yet handled and generating error trees. But in the future we will drop the former completely (apart from cyclic errors which can pop up almost everywhere). Review by odersky, extempore and anyone who feels like it. --- test/files/neg/patternalts.check | 5 ++++- test/files/neg/t1878.check | 11 +++++++---- test/files/neg/t2641.check | 30 +++++++++++++++--------------- test/files/neg/t2918.check | 8 ++++---- test/files/neg/t3015.check | 7 +------ test/files/neg/t997.check | 8 +++++++- test/files/neg/volatile.check | 7 ++----- 7 files changed, 40 insertions(+), 36 deletions(-) (limited to 'test/files') diff --git a/test/files/neg/patternalts.check b/test/files/neg/patternalts.check index 9bec9a001a..63bd244345 100644 --- a/test/files/neg/patternalts.check +++ b/test/files/neg/patternalts.check @@ -1,4 +1,7 @@ patternalts.scala:3: error: illegal variable in pattern alternative case List(x) | List() => Console.println(x) ^ -one error found +patternalts.scala:3: error: not found: value x + case List(x) | List() => Console.println(x) + ^ +two errors found diff --git a/test/files/neg/t1878.check b/test/files/neg/t1878.check index 4b9cfebde1..de59b023ab 100644 --- a/test/files/neg/t1878.check +++ b/test/files/neg/t1878.check @@ -1,15 +1,18 @@ -t1878.scala:3: error: _* may only come last - val err1 = "" match { case Seq(f @ _*, ',') => f } - ^ t1878.scala:3: error: scrutinee is incompatible with pattern type; found : Seq[A] required: java.lang.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:3: error: _* may only come last + 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

{ _* }

=> ^ -four errors found +5 errors found diff --git a/test/files/neg/t2641.check b/test/files/neg/t2641.check index 2056a1b9ab..595dd46b11 100644 --- a/test/files/neg/t2641.check +++ b/test/files/neg/t2641.check @@ -1,24 +1,15 @@ t2641.scala:18: error: illegal cyclic reference involving trait ManagedSeq with TraversableViewLike[A, ManagedSeqStrict[A], ManagedSeq[A]] ^ -t2641.scala:16: error: illegal inheritance; - self-type ManagedSeq does not conform to ManagedSeqStrict[A]'s selftype ManagedSeqStrict[A] - extends ManagedSeqStrict[A] - ^ -t2641.scala:17: error: illegal inheritance; - self-type ManagedSeq does not conform to scala.collection.TraversableView[A,ManagedSeqStrict[A]]'s selftype scala.collection.TraversableView[A,ManagedSeqStrict[A]] - with TraversableView[A, ManagedSeqStrict[A]] - ^ -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:27: error: value managedIterator is not a member of ManagedSeq + override def managedIterator = self.managedIterator slice (from, until) + ^ t2641.scala:26: error: illegal inheritance; superclass Any is not a subclass of the superclass ManagedSeqStrict of the mixin trait Transformed @@ -29,7 +20,16 @@ t2641.scala:26: error: illegal inheritance; superclass Any 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) - ^ +t2641.scala:16: error: illegal inheritance; + self-type ManagedSeq does not conform to ManagedSeqStrict[A]'s selftype ManagedSeqStrict[A] + extends ManagedSeqStrict[A] + ^ +t2641.scala:17: error: illegal inheritance; + self-type ManagedSeq does not conform to scala.collection.TraversableView[A,ManagedSeqStrict[A]]'s selftype scala.collection.TraversableView[A,ManagedSeqStrict[A]] + with TraversableView[A, ManagedSeqStrict[A]] + ^ +t2641.scala:16: error: illegal inheritance; + self-type ManagedSeq does not conform to ScalaObject's selftype ScalaObject + extends ManagedSeqStrict[A] + ^ 9 errors found diff --git a/test/files/neg/t2918.check b/test/files/neg/t2918.check index e67f24ec57..d125895463 100644 --- a/test/files/neg/t2918.check +++ b/test/files/neg/t2918.check @@ -1,7 +1,7 @@ -t2918.scala:2: error: cyclic aliasing or subtyping involving type A - 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 ^ +t2918.scala:2: error: cyclic aliasing or subtyping involving type A + def g[X, A[X] <: A[X]](x: A[X]) = x + ^ two errors found diff --git a/test/files/neg/t3015.check b/test/files/neg/t3015.check index 32809b0669..fec54b087b 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: java.lang.String val b(foo) = "foo" ^ -t3015.scala:7: error: type mismatch; - found : _$1(in value foo) where type _$1(in value foo) <: java.lang.String - required: (some other)_$1(in value foo) where type (some other)_$1(in value foo) - val b(foo) = "foo" - ^ -two errors found +one error found diff --git a/test/files/neg/t997.check b/test/files/neg/t997.check index c9fe0de756..166d465971 100644 --- a/test/files/neg/t997.check +++ b/test/files/neg/t997.check @@ -10,4 +10,10 @@ t997.scala:13: error: wrong number of arguments for object Foo t997.scala:13: error: not found: value a "x" match { case Foo(a, b, c) => Console.println((a,b,c)) } ^ -four errors found +t997.scala:13: error: not found: value b +"x" match { case Foo(a, b, c) => Console.println((a,b,c)) } + ^ +t997.scala:13: error: not found: value c +"x" match { case Foo(a, b, c) => Console.println((a,b,c)) } + ^ +6 errors found diff --git a/test/files/neg/volatile.check b/test/files/neg/volatile.check index b904284125..da27c68e6c 100644 --- a/test/files/neg/volatile.check +++ b/test/files/neg/volatile.check @@ -1,7 +1,4 @@ -volatile.scala:11: error: Inferred type C.this.D with C.this.E#T contains type selection from volatile type C.this.D with C.this.E +volatile.scala:11: error: Inferred type C.this.D with C.this.E#T contains type selection from volatile type C.this.D with C.this.E#T var sneak = { () => y.x } ^ -volatile.scala:11: error: Inferred type () => C.this.D with C.this.E#T contains type selection from volatile type C.this.D with C.this.E - var sneak = { () => y.x } - ^ -two errors found +one error found -- cgit v1.2.3