diff options
author | Paul Phillips <paulp@improving.org> | 2013-01-02 07:09:21 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-01-09 12:11:15 -0800 |
commit | a419799f872d5aae99728d711b1ced89e06804a8 (patch) | |
tree | 572d18cb43f281939ccb2729f19e7096f5017508 /test/files/neg/t6566a.scala | |
parent | 567df8ef284ab7491d6e144eb169db77d8ac06be (diff) | |
download | scala-a419799f872d5aae99728d711b1ced89e06804a8.tar.gz scala-a419799f872d5aae99728d711b1ced89e06804a8.tar.bz2 scala-a419799f872d5aae99728d711b1ced89e06804a8.zip |
SI-6566, unsoundness with alias variance.
This wasn't as bad as it could have been. All these changes
plug soundness holes in trunk. Mostly we're looking at type
aliases which were merely protected when they had to be
protected[this] not to allow unsound variance crossover.
Diffstat (limited to 'test/files/neg/t6566a.scala')
-rw-r--r-- | test/files/neg/t6566a.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/files/neg/t6566a.scala b/test/files/neg/t6566a.scala new file mode 100644 index 0000000000..74a0b38e56 --- /dev/null +++ b/test/files/neg/t6566a.scala @@ -0,0 +1,17 @@ +object WhatsYourTypeIsMyType { + class TypeCheat[+T] { type MyType = T } + + class Foo { + val tc = new TypeCheat[Foo] + var x: tc.MyType = _ + def setX() = x = new Foo + } + class Bar extends Foo { + override val tc = new TypeCheat[Bar] + def unsound = this + + setX() + println(x.unsound) + } + def main(args: Array[String]): Unit = new Bar +} |