diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-09-24 17:27:20 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2009-09-24 17:27:20 +0000 |
commit | 6fea2488af12d942c1cf7ba781d2f60fe6ddc9c0 (patch) | |
tree | 8dfb5b1df353a5da15a92f8d5873f1617f800864 | |
parent | fb38e47af1dec087a11585c6878c70ccdc930312 (diff) | |
download | scala-6fea2488af12d942c1cf7ba781d2f60fe6ddc9c0.tar.gz scala-6fea2488af12d942c1cf7ba781d2f60fe6ddc9c0.tar.bz2 scala-6fea2488af12d942c1cf7ba781d2f60fe6ddc9c0.zip |
fix #2390
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 5 | ||||
-rw-r--r-- | test/files/run/names-defaults.scala | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 1b2fde4f4a..dd166b3086 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -307,8 +307,9 @@ trait Namers { self: Analyzer => ltype = new PolyTypeCompleter(tparams, ltype, tree, sym, context) //@M if (sym.isTerm) skolemize(tparams) } - if ((sym.name == nme.copy || sym.name.startsWith(nme.copy + "$default$")) && - sym.hasFlag(SYNTHETIC)) { + def copyIsSynthetic() = sym.owner.info.member(nme.copy).hasFlag(SYNTHETIC) + if (sym.name == nme.copy && sym.hasFlag(SYNTHETIC) || + sym.name.startsWith(nme.copy + "$default$") && copyIsSynthetic()){ // the 'copy' method of case classes needs a special type completer to make bug0054.scala (and others) // work. the copy method has to take exactly the same parameter types as the primary constructor. setInfo(sym)(mkTypeCompleter(tree)(copySym => { diff --git a/test/files/run/names-defaults.scala b/test/files/run/names-defaults.scala index 1235869db7..1f92436628 100644 --- a/test/files/run/names-defaults.scala +++ b/test/files/run/names-defaults.scala @@ -257,9 +257,11 @@ object Test extends Application { spawn(b = { val ttt = 1; ttt }, a = 0) } - // # 2382 + // #2382 class A2382[+T](x: T => Int) { def foo(a: T => Int = x) = 0 } + // #2390 + case class A2390[T](x: Int) { def copy(a: Int)(b: Int = 0) = 0 } // DEFINITIONS def test1(a: Int, b: String) = println(a +": "+ b) |