From a419799f872d5aae99728d711b1ced89e06804a8 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 2 Jan 2013 07:09:21 -0800 Subject: 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. --- test/files/neg/t6566b.scala | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/files/neg/t6566b.scala (limited to 'test/files/neg/t6566b.scala') diff --git a/test/files/neg/t6566b.scala b/test/files/neg/t6566b.scala new file mode 100644 index 0000000000..18ddebf88b --- /dev/null +++ b/test/files/neg/t6566b.scala @@ -0,0 +1,19 @@ +object WhatsYourTypeIsMyType { + trait WithMyType[+T] { + type MyType = T + } + + class Foo extends WithMyType[Foo] { + var x: MyType = _ + def setX() = x = new Foo + } + + class Bar extends Foo with WithMyType[Bar] { + def unsound { println("iAmABar") } + + setX() + println(x.unsound) + } + + def main(args: Array[String]): Unit = new Bar +} -- cgit v1.2.3