summaryrefslogtreecommitdiff
path: root/test/files/neg/patmat-type-check.check
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-10-01 05:44:50 -0700
committerPaul Phillips <paulp@improving.org>2012-10-01 07:11:41 -0700
commitd2074796a8b822c4c82faecc8eb0eef4837508e3 (patch)
treef268171ea21f98a5c4d32185a59106f657b9912e /test/files/neg/patmat-type-check.check
parentc479a0e3a1fc5d5ee7391ecc8a0d599fd74bb40f (diff)
downloadscala-d2074796a8b822c4c82faecc8eb0eef4837508e3.tar.gz
scala-d2074796a8b822c4c82faecc8eb0eef4837508e3.tar.bz2
scala-d2074796a8b822c4c82faecc8eb0eef4837508e3.zip
Fix for TypeVar instantiation.
In an effort to reduce the enormous amount of duplication which now exists among methods which attempt to deduce something about the relationship between two types, a sampling (and only a sampling - this might not even be half of them) given here: def isAsSpecific(ftpe1: Type, ftpe2: Type): Boolean def isCompatibleByName(tp: Type, pt: Type): Boolean def isConservativelyCompatible(tp: Type, pt: Type): Boolean def isConsistent(tp1: Type, tp2: Type): Boolean def isDifferentType(tp1: Type, tp2: Type): Boolean def isDifferentTypeConstructor(tp1: Type, tp2: Type): Boolean def isDistinguishableFrom(t1: Type, t2: Type): Boolean def isNeverSubType(tp1: Type, tp2: Type): Boolean def isNumericSubType(tp1: Type, tp2: Type): Boolean def isPlausiblyCompatible(tp: Type, pt: Type): Boolean def isPopulated(tp1: Type, tp2: Type): Boolean def isSameType(tp1: Type, tp2: Type): Boolean def isSameType2(tp1: Type, tp2: Type): Boolean def isSubType(tp1: Type, tp2: Type): Boolean def isWeakSubType(tp1: Type, tp2: Type): Boolean def isWeaklyCompatible(tp: Type, pt: Type): Boolean def matches(tpe1: Type, tpe2: Type): Boolean def overlaps(tp1: Type, tp2: Type): Boolean def typesConform(tp: Type, pt: Type): Boolean I began pulling a thread left by moors in isPopulated: need to investgate why this can't be made symmetric -- neg/gadts1 fails, and run/existials also. Followed that to this code in TypeVar: val newInst = wildcardToTypeVarMap(tp) (constr isWithinBounds newInst) && { setInst(tp); true } -------^ That was the obstacle to symmetry, because it creates a cycle in e.g. run/existentials. Kept pulling the string, came back to my own comment of long ago: !!! Is it somehow guaranteed that this will not break under nesting? In general one has to save and restore the contents of the field... Decided that uncertainty could no longer be tolerated. Unless it can be proven somehow that there will never be crosstalk among the save/suspension points, we should do it this way even if nothing demands it yet. What's in this commit: - Made isPopulated symmetric. - Made setInst resistant to TypeVar cycles. - Fixed above mentioned bug in registerTypeEquality. - Added some rigor to the suspension/unsuspension of TypeVars so it will not break under nesting. - Recovered pos/t0851.scala from its deletion.
Diffstat (limited to 'test/files/neg/patmat-type-check.check')
-rw-r--r--test/files/neg/patmat-type-check.check17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/files/neg/patmat-type-check.check b/test/files/neg/patmat-type-check.check
index 721217c314..fedac3b746 100644
--- a/test/files/neg/patmat-type-check.check
+++ b/test/files/neg/patmat-type-check.check
@@ -1,12 +1,27 @@
patmat-type-check.scala:11: warning: fruitless type test: a value of type Test.Bop4[T] cannot also be a Seq[A]
def s3[T](x: Bop4[T]) = x match { case Seq('b', 'o', 'b') => true }
^
+patmat-type-check.scala:11: error: pattern type is incompatible with expected type;
+ found : Seq[A]
+ required: Test.Bop4[T]
+ def s3[T](x: Bop4[T]) = x match { case Seq('b', 'o', 'b') => true }
+ ^
patmat-type-check.scala:15: warning: fruitless type test: a value of type Test.Bop5[_$1,T1,T2] cannot also be a Seq[A]
def s4[T1, T2](x: Bop5[_, T1, T2]) = x match { case Seq('b', 'o', 'b') => true }
^
+patmat-type-check.scala:15: error: pattern type is incompatible with expected type;
+ found : Seq[A]
+ required: Test.Bop5[_$1,T1,T2] where type _$1
+ def s4[T1, T2](x: Bop5[_, T1, T2]) = x match { case Seq('b', 'o', 'b') => true }
+ ^
patmat-type-check.scala:19: warning: fruitless type test: a value of type Test.Bop3[T] cannot also be a Seq[A]
def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true }
^
+patmat-type-check.scala:19: error: pattern type is incompatible with expected type;
+ found : Seq[A]
+ required: Test.Bop3[T]
+ def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true }
+ ^
patmat-type-check.scala:22: error: scrutinee is incompatible with pattern type;
found : Seq[A]
required: String
@@ -28,4 +43,4 @@ patmat-type-check.scala:30: error: scrutinee is incompatible with pattern type;
def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail
^
three warnings found
-four errors found
+7 errors found