From 6b1d01b1b28d965586a54c1f4c1fe3adfc36545b Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 17 Feb 2006 14:17:25 +0000 Subject: --- test/files/neg/forward.check | 10 ++++++++++ test/files/neg/forward.scala | 24 ++++++++++++++++++++++++ test/files/pos/bug530.scala | 30 ++++++++++++++++++++++++++++++ test/files/pos/bug532.scala | 10 ++++++++++ test/files/run/exceptions-2.check | 4 ++-- 5 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 test/files/neg/forward.check create mode 100755 test/files/neg/forward.scala create mode 100755 test/files/pos/bug530.scala create mode 100644 test/files/pos/bug532.scala (limited to 'test') diff --git a/test/files/neg/forward.check b/test/files/neg/forward.check new file mode 100644 index 0000000000..df847a0e86 --- /dev/null +++ b/test/files/neg/forward.check @@ -0,0 +1,10 @@ +forward.scala:6 error: forward reference extends over definition of value x + def f: int = x; + ^ +forward.scala:10 error: forward reference extends over definition of value x + def f: int = g; + ^ +forward.scala:15 error: forward reference extends over definition of variable x + def f: int = g; + ^ +three errors found diff --git a/test/files/neg/forward.scala b/test/files/neg/forward.scala new file mode 100755 index 0000000000..5e21e4c1fe --- /dev/null +++ b/test/files/neg/forward.scala @@ -0,0 +1,24 @@ +object Test { + def f: int = x; + val x: int = f; + + { + def f: int = x; + val x: int = f; + } + { + def f: int = g; + val x: int = f; + def g: int = x; + } + { + def f: int = g; + var x: int = f; + def g: int = x; + } + { + def f: int = g; + System.out.println("foo"); + def g: int = f; + } +} diff --git a/test/files/pos/bug530.scala b/test/files/pos/bug530.scala new file mode 100755 index 0000000000..6c887d6821 --- /dev/null +++ b/test/files/pos/bug530.scala @@ -0,0 +1,30 @@ +// scala.tools.nsc.Main.scala +package test; + +/** The main class for NSC, a compiler for the programming + * language Scala. + */ +object Test { +/* + def process(): AnyRef = { + class Compiler; + var compiler$module: Compiler = new Compiler; + def compiler() = compiler$module; + class Generator { + val c : Compiler = compiler() + } + var generator$module: Generator = new Generator; + def generator() = generator$module; + generator() + } +*/ + def process1(): AnyRef = { + object generator { + val c = compiler + } + object compiler; + generator + } + + +} diff --git a/test/files/pos/bug532.scala b/test/files/pos/bug532.scala new file mode 100644 index 0000000000..82da9c817f --- /dev/null +++ b/test/files/pos/bug532.scala @@ -0,0 +1,10 @@ +object Test extends Application { + import scala.reflect._; + def titi: Unit = { + var truc = 0 + val tata: TypedCode[()=>Unit] = () => { + truc = 6 + } + () + } +} diff --git a/test/files/run/exceptions-2.check b/test/files/run/exceptions-2.check index 40edd78ca2..3ec0dfcc1c 100644 --- a/test/files/run/exceptions-2.check +++ b/test/files/run/exceptions-2.check @@ -17,8 +17,8 @@ method3: Exception occurred with stack trace: java.lang.NullPointerException at Test$.method3(exceptions-2.scala:108) - at Test$$anonfun5.apply(exceptions-2.scala:151) - at Test$$anonfun5.apply(exceptions-2.scala:151) + at Test$$anonfun$5.apply(exceptions-2.scala:151) + at Test$$anonfun$5.apply(exceptions-2.scala:151) at Test$.execute(exceptions-2.scala:128) at Test$.main(exceptions-2.scala:151) at Test.main(exceptions-2.scala) -- cgit v1.2.3