aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-06-05 22:38:01 +0200
committerMartin Odersky <odersky@gmail.com>2015-06-06 11:05:27 +0200
commit0ee8e506dac87bae6ec432b2cd277109df872145 (patch)
tree1a916c66c738c9005b534ed2efe48c382ccaa031 /tests
parent84bf5902dba61c88f1b50229bb3afa5a335ded94 (diff)
downloaddotty-0ee8e506dac87bae6ec432b2cd277109df872145.tar.gz
dotty-0ee8e506dac87bae6ec432b2cd277109df872145.tar.bz2
dotty-0ee8e506dac87bae6ec432b2cd277109df872145.zip
Skolemize unstable prefixes in asSeenFrom
Skolemize unstable prefixes in asSeenFrom provided - the prefix appears at least once in non-variant or contra-variant position - we are in phase typer. After typer, we have already established soundness, so there's no need to do skolemization again. We can simply do the (otherwise unsound) substitution from this-type to prefix.
Diffstat (limited to 'tests')
-rw-r--r--tests/neg/i0583-skolemize.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/neg/i0583-skolemize.scala b/tests/neg/i0583-skolemize.scala
new file mode 100644
index 000000000..e0bb99e5d
--- /dev/null
+++ b/tests/neg/i0583-skolemize.scala
@@ -0,0 +1,27 @@
+import scala.collection.mutable.ListBuffer
+
+object Test1 {
+
+ class Box[T](x: T)
+ def box[T](x: T) = new Box[T](x)
+
+ class C[T] { def x: T = ???; def x_=(y: T): Unit = ??? }
+
+ val c: C[Int] = ???
+ val d: C[Float] = ???
+
+ val xs: List[C[_]] = List(c, d)
+
+ xs(0).x = xs(1).x
+
+}
+object Test {
+ def main(args: Array[String]): Unit = {
+ val f: ListBuffer[Int] = ListBuffer(1,2)
+ val g: ListBuffer[Double] = ListBuffer(3.0,4.0)
+ val lb: ListBuffer[ListBuffer[_]] = ListBuffer(f, g)
+ lb(0)(0) = lb(1)(0)
+ val x: Int = f(0)
+ }
+}
+