summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
-rw-r--r--test/files/run/names-defaults.scala3
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))