diff options
author | Paul Phillips <paulp@improving.org> | 2013-09-27 00:32:40 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-09-27 00:34:13 -0700 |
commit | 693ecffbaf5be036e05300a1ee3a8444c0ac0fe3 (patch) | |
tree | 1032802cd3e29e7bb9c8cd2abad8dcb0a0b3ed8f /src/compiler/scala/tools/nsc/typechecker/Namers.scala | |
parent | 0aaf59149871f817a67c1fefcc3b0457fcb5e4fc (diff) | |
download | scala-693ecffbaf5be036e05300a1ee3a8444c0ac0fe3.tar.gz scala-693ecffbaf5be036e05300a1ee3a8444c0ac0fe3.tar.bz2 scala-693ecffbaf5be036e05300a1ee3a8444c0ac0fe3.zip |
Fix up DEFAULTPARAM semantics.
I foolishly believed the deprecation message on "hasDefaultFlag"
which suggested I use "hasDefault" instead. After lots of head
scratching, I hardened the semantics so it's like this:
- A method parameter with a default value is PARAM | DEFAULTPARAM
- A default getter for such a parameter is METHOD | DEFAULTPARAM
- And "hasDefault" is has(DEFAULTPARAM) && has(PARAM | METHOD)
Why all the bonus logic, why not just hasFlag(DEFAULTPARAM)? For
some reason we have a handful of overloaded flags spanning uses
which someone apparently thinks can never intersect but I have
not been so lucky overall. So since DEFAULTPARAM is overloaded with
TRAIT, unless we think it's fine that default getters and method
parameters with defaults will pose as traits all the time, there
has to be an anchor bit alongside it.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 347426d42a..4cfac91a94 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1272,9 +1272,7 @@ trait Namers extends MethodSynthesis { val defRhs = copyUntyped(vparam.rhs) val defaultTree = atPos(vparam.pos.focus) { - DefDef( - Modifiers(meth.flags & DefaultGetterFlags) | (SYNTHETIC | DEFAULTPARAM | oflag).toLong, - name, deftParams, defvParamss, defTpt, defRhs) + DefDef(Modifiers(paramFlagsToDefaultGetter(meth.flags)) | oflag, name, deftParams, defvParamss, defTpt, defRhs) } if (!isConstr) methOwner.resetFlag(INTERFACE) // there's a concrete member now |