From 3fea9472c0d068bc08ae764429ca6b4bca95bcd8 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 17 Oct 2014 15:35:11 +0200 Subject: Avoid hoisting local classes The patch disables hoisting of classes local to a block into the result type of the block. Instead, we widen the result type of the block to one which reflects all refinements made to the parents type of the local class. Test cases in avoid.scala, t1569.scala. The original t1569.scala no longer works. Why is explained in neg/t1569-failedAvoid.scala --- tests/pos/avoid.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/pos/avoid.scala (limited to 'tests/pos/avoid.scala') diff --git a/tests/pos/avoid.scala b/tests/pos/avoid.scala new file mode 100644 index 000000000..51471feaa --- /dev/null +++ b/tests/pos/avoid.scala @@ -0,0 +1,10 @@ +abstract class C { + def y: Any +} + +object test { + val x = new C{ + def y: String = "abc" + } + val z: String = x.y +} -- cgit v1.2.3