diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-11-12 14:57:15 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-11-12 14:57:15 +0000 |
commit | 39fb348121e43dd3d48b378f43a68ed8fc5fc157 (patch) | |
tree | 7bdd060384e32f4c51903cc240fc9df5c37a4593 | |
parent | 5995692ffd9bd401589117b10029b63503cad6be (diff) | |
download | scala-39fb348121e43dd3d48b378f43a68ed8fc5fc157.tar.gz scala-39fb348121e43dd3d48b378f43a68ed8fc5fc157.tar.bz2 scala-39fb348121e43dd3d48b378f43a68ed8fc5fc157.zip |
avoid illegal forward references by moving synt...
avoid illegal forward references by moving synthetics to the beginning
of the statement-list. fixes #2489
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 2 | ||||
-rw-r--r-- | test/files/run/names-defaults.scala | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 50627268c8..a7fd4f3a50 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2054,7 +2054,7 @@ trait Typers { self: Analyzer => moreToAdd = initSize != scope.size } if (newStats.isEmpty) stats - else stats ::: newStats.toList + else newStats.toList ::: stats } val result = stats mapConserve (typedStat) if (phase.erasedTypes) result diff --git a/test/files/run/names-defaults.scala b/test/files/run/names-defaults.scala index d5524b95ab..0d4f3df42e 100644 --- a/test/files/run/names-defaults.scala +++ b/test/files/run/names-defaults.scala @@ -265,6 +265,9 @@ object Test extends Application { // #2390 case class A2390[T](x: Int) { def copy(a: Int)(b: Int = 0) = 0 } + // #2489 + class A2489 { def foo { def bar(a: Int = 1) = a; bar(); val u = 0 } } + // DEFINITIONS def test1(a: Int, b: String) = println(a +": "+ b) def test2(u: Int, v: Int)(k: String, l: Int) = println(l +": "+ k +", "+ (u + v)) |