From 9a4b5e7c306eb3f1c82ace10dd62576473b1dec1 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 20 Jun 2015 00:44:47 +0200 Subject: Map outer fields to parameters in primary constructor Previously this was only done in secondary constructors; need to do it in primary constructor as well to avoid "reference to this before super" problems. --- tests/pending/run/NestedClasses.check | 9 ---- tests/pending/run/NestedClasses.scala | 97 ----------------------------------- tests/pending/run/t8611b.flags | 1 - tests/pending/run/t8611b.scala | 54 ------------------- 4 files changed, 161 deletions(-) delete mode 100644 tests/pending/run/NestedClasses.check delete mode 100644 tests/pending/run/NestedClasses.scala delete mode 100644 tests/pending/run/t8611b.flags delete mode 100644 tests/pending/run/t8611b.scala (limited to 'tests/pending') diff --git a/tests/pending/run/NestedClasses.check b/tests/pending/run/NestedClasses.check deleted file mode 100644 index a7ebc386e..000000000 --- a/tests/pending/run/NestedClasses.check +++ /dev/null @@ -1,9 +0,0 @@ -e.e1 = 119 -cc.m = 3 -cc.am = 1 -cc.bm = 2 -aaa.f = 111 -bbb1.f = 42 -bbb2.f = 24 -bbb3.f = 24 -bbb4.f = 24 diff --git a/tests/pending/run/NestedClasses.scala b/tests/pending/run/NestedClasses.scala deleted file mode 100644 index 6db713e08..000000000 --- a/tests/pending/run/NestedClasses.scala +++ /dev/null @@ -1,97 +0,0 @@ -//############################################################################ -// Test nested classes -//############################################################################ - -// The following set of classes tests nasty references to "outer" -// values. - -class A(pa : Int) { - def a1 = pa; - class B(pb : Int) { - def b1 = pa+pb+a1; - class C(pc : Int) extends A(b1) { - def c1 = pc+pb+pa - } - val c1 = new C(13) - } -} - -trait M { - def m1 = 1 -} - -class A1(x : Int) extends A(x) with M { - class D extends B(14) { - val c2 = new C(15); - class E extends C(16) { - def e1 = c1+b1+a1+m1; - def e2 = new D(); - } - } -} - -// The following set of classes test qualified "this" and "super" -// references. - -class AA { - def m = 1; - class BB { - def m = 2; - class CC { - def m = 3; - def am = AA.this.m; - def bm = BB.this.m; - } - } -} - -class AAA { - def f = 42; -} - -class BBB extends AAA { - override def f = 24; -} - -class AAA1 extends AAA { - override def f = 111; - class BBB1 extends BBB { - override def f = AAA1.super.f; - } - class BBB2 extends BBB { - override def f = BBB2.super.f; - } - class BBB3 extends BBB { - override def f = super.f; - } - class BBB4 extends BBB { } -} - -object Test { - def main(args: Array[String]): Unit = { - val a = new A1(12); - val d = new a.D; - val e = new d.E; - Console.println("e.e1 = " + e.e1); - - val aa = new AA; - val bb = new aa.BB; - val cc = new bb.CC; - Console.println("cc.m = " + cc.m); - Console.println("cc.am = " + cc.am); - Console.println("cc.bm = " + cc.bm); - - val aaa = new AAA1; - val bbb1 = new aaa.BBB1; - val bbb2 = new aaa.BBB2; - val bbb3 = new aaa.BBB3; - val bbb4 = new aaa.BBB4; - Console.println("aaa.f = " + aaa.f); - Console.println("bbb1.f = " + bbb1.f); - Console.println("bbb2.f = " + bbb2.f); - Console.println("bbb3.f = " + bbb3.f); - Console.println("bbb4.f = " + bbb4.f); - } -} - -//############################################################################ diff --git a/tests/pending/run/t8611b.flags b/tests/pending/run/t8611b.flags deleted file mode 100644 index 85d8eb2ba..000000000 --- a/tests/pending/run/t8611b.flags +++ /dev/null @@ -1 +0,0 @@ --Xfatal-warnings diff --git a/tests/pending/run/t8611b.scala b/tests/pending/run/t8611b.scala deleted file mode 100644 index 75114c2ae..000000000 --- a/tests/pending/run/t8611b.scala +++ /dev/null @@ -1,54 +0,0 @@ -sealed trait KrafsDescription - -abstract class NotWorkingEnum extends Enumeration { - - type ExtendedValue = Value with KrafsDescription - - def Enum(inDescription: String): ExtendedValue = { - new Val(nextId) with KrafsDescription { - } - } -} - -abstract class WorkingEnum extends Enumeration { - - type ExtendedValue = Value - - def Enum(inDescription: String): ExtendedValue = { - new Val(nextId) { - } - } -} - -object NotWorkingTab extends NotWorkingEnum { - val a = Enum("A") - val b = Enum("B") -} - -object WorkingTab extends WorkingEnum { - val a = Enum("A") - val b = Enum("B") -} - -object Test extends dotty.runtime.LegacyApp { - testGris() - testWorking() - - def testGris(): Unit = { - val pipp = NotWorkingTab.b - pipp match { - case NotWorkingTab.a => ??? - case NotWorkingTab.b => - case _ => ??? - } - } - - def testWorking(): Unit = { - val stuff = WorkingTab.a - stuff match { - case WorkingTab.a => - case WorkingTab.b => ??? - case _ => ??? - } - } -} -- cgit v1.2.3