summaryrefslogtreecommitdiff
path: root/test/files/neg/t5189_inferred.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-01-09 14:44:47 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-01-14 15:40:23 -0800
commitbd4bfface0581041d27c5d243723e39dd99c28fc (patch)
tree0fbfba98dc2d350a6396ab6bd52a8f9a53f86c20 /test/files/neg/t5189_inferred.scala
parenta49722990655633c2c97ddf5699adf25bc8bea76 (diff)
downloadscala-bd4bfface0581041d27c5d243723e39dd99c28fc.tar.gz
scala-bd4bfface0581041d27c5d243723e39dd99c28fc.tar.bz2
scala-bd4bfface0581041d27c5d243723e39dd99c28fc.zip
SI-5189 detect unsoundness when inferring type of match
GADT skolems encode type slack that results from pattern matching on variant type constructors I thought they would not longer be relevant after cases have been typed, and since they caused weird issues with the old pattern matcher, I deskolemized in typedCase however, when we don't have an expected type for the match, we need to keep the skolems around until the skolemized type makes it out of the match and it becomes the result of type inference for that match when you do have an expected type, it will propagate to the case-level and the confrontation will thus already take place when typing individual cases
Diffstat (limited to 'test/files/neg/t5189_inferred.scala')
-rw-r--r--test/files/neg/t5189_inferred.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/files/neg/t5189_inferred.scala b/test/files/neg/t5189_inferred.scala
new file mode 100644
index 0000000000..e4e8765445
--- /dev/null
+++ b/test/files/neg/t5189_inferred.scala
@@ -0,0 +1,8 @@
+trait Covariant[+A]
+case class Invariant[A](xs: Array[A]) extends Covariant[A]
+
+class Test {
+ val arr = Array("abc")
+ def f[A](v: Covariant[A]) /*inferred!*/ = v match { case Invariant(xs) => xs }
+ f(Invariant(arr): Covariant[Any])(0) = Nil
+} \ No newline at end of file