From 640ecf38b7125ff0d2c926a9a634593640cd95b1 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 30 Oct 2006 13:00:41 +0000 Subject: added healing for escaping singleton types. fixed bug 397 --- test/files/neg/bug783.check | 4 ++++ test/files/neg/bug783.scala | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 test/files/neg/bug783.check create mode 100644 test/files/neg/bug783.scala (limited to 'test/files/neg') diff --git a/test/files/neg/bug783.check b/test/files/neg/bug783.check new file mode 100644 index 0000000000..9594db14e7 --- /dev/null +++ b/test/files/neg/bug783.check @@ -0,0 +1,4 @@ +bug783.scala:12 error: stable identifier required, but Contexts.this.globalInit0 found. + globalInit0.Template(10, 20); + ^ +one error found diff --git a/test/files/neg/bug783.scala b/test/files/neg/bug783.scala new file mode 100644 index 0000000000..0180d3d634 --- /dev/null +++ b/test/files/neg/bug783.scala @@ -0,0 +1,29 @@ +package test; + +object Main extends Application { + class Global { + case class Template(x : Int, y : Int) { + Console.println("outer: " + Global.this); + } + } + trait Contexts requires Analyzer { + val xxx : global.Template = { + assert(globalInit0 != null); + globalInit0.Template(10, 20); + } + } + abstract class Analyzer extends Contexts { + type Global <: Main.Global; + final val global : Global = globalInit; + def globalInit : Global; + final def globalInit0 = globalInit.asInstanceOf[global.type]; + } + + object global0 extends Global { + object analyzer extends Analyzer { + type Global = global0.type; + override def globalInit = global0; + } + } + Console.println(global0.analyzer.xxx); +} -- cgit v1.2.3