From dc97215ec989aa4739c18aa74fa8f2ead78402f4 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 12 Sep 2006 10:18:33 +0000 Subject: fixes to ExplicitOuter to pass test suite --- test/files/pos/bug704.scala | 27 ++++++++++++++++++--------- test/files/run/implicits.check | 2 ++ test/files/run/implicits.scala | 25 +++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 test/files/run/implicits.check create mode 100755 test/files/run/implicits.scala (limited to 'test') diff --git a/test/files/pos/bug704.scala b/test/files/pos/bug704.scala index aea8292f2d..a05e0a51e7 100644 --- a/test/files/pos/bug704.scala +++ b/test/files/pos/bug704.scala @@ -1,14 +1,23 @@ trait D { - private val x = 1 + private val x = "xxxx should appear twice" private object xxxx { Console.println(x) } + def get_xxxx: AnyRef = xxxx } -object Go extends D { - def main(args : Array[String]) : Unit = {}; -} -trait D2 { - val x = 1 - object yyyy { Console.println(x) } + +trait E extends D { + def f(): unit = { + val y = "yyyy should appear twice" + object yyyy { + val x1 = get_xxxx + Console.println(y) + } + yyyy + } } -object Go2 extends D2 { - def main(args : Array[String]) : Unit = {}; +class C extends E {} +object Go extends D { + def main(args : Array[String]) { + new C().f() + new C().f() + } } diff --git a/test/files/run/implicits.check b/test/files/run/implicits.check new file mode 100644 index 0000000000..010571589c --- /dev/null +++ b/test/files/run/implicits.check @@ -0,0 +1,2 @@ +OK +[2] diff --git a/test/files/run/implicits.scala b/test/files/run/implicits.scala new file mode 100755 index 0000000000..c45badc49f --- /dev/null +++ b/test/files/run/implicits.scala @@ -0,0 +1,25 @@ +object A { + object B { + implicit def int2string(x: int) = "["+x.toString+"]" + } +} + +class C(x: String) { + + class Inner { + } + + object Inner { + val s: String = x + implicit def Inner2String(x: Inner): String = s + } +} + +object Test extends Application { + import A.B._ + val c = new C("OK") + val i = new c.Inner + val s: String = i + Console.println(s) + Console.println(2: String) +} -- cgit v1.2.3