From ec4a3a0f4d0b8cccf636d1608896e7cafba9dec0 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 2 Feb 2016 10:21:12 +0100 Subject: Big realizability refactoring Move logic from TypeOps to new file CheckRealizable.scala. Also check realizable fields under strict mode. Check at phase PostTyper rather than Typer to avoid cycles. New tests for imports and deep paths. --- tests/neg/i1050c.scala | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/neg/i1050c.scala (limited to 'tests/neg/i1050c.scala') diff --git a/tests/neg/i1050c.scala b/tests/neg/i1050c.scala new file mode 100644 index 000000000..ece1f9986 --- /dev/null +++ b/tests/neg/i1050c.scala @@ -0,0 +1,31 @@ +// i1050 checks failing at typer +object Import { + trait A { type L <: Nothing } + trait B { type L >: Any} + trait U { + lazy val p: B + locally { val x: p.L = ??? } // error: nonfinal lazy + locally { + import p._ + val x: L = ??? // error: nonfinal lazy + } + } +} +object Tiark4 { + trait U { + type Y + trait X { type L = Y } + def compute: X + final lazy val p: X = compute + def brand(x: Y): p.L = x + } + trait V extends U { + type Y >: Any <: Nothing + def compute: X = ??? + } + val v = new V {} // error: cannot be instantiated + v.brand("boom!") +} +object V { // error: cannot be instantiated + type Y >: Any <: Nothing // error: only classes can have declared but undefined members +} -- cgit v1.2.3