diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-12 18:02:26 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-08-12 18:02:26 +0200 |
commit | 843f9769f5fc5572f06e058af65e43f81b8d432d (patch) | |
tree | ce722a8d710af070804cada4e3310e25550ef680 /src/dotty/tools/dotc/ast/Desugar.scala | |
parent | 81745e2779fe13076e73538e66e3352cb9cd9cf3 (diff) | |
download | dotty-843f9769f5fc5572f06e058af65e43f81b8d432d.tar.gz dotty-843f9769f5fc5572f06e058af65e43f81b8d432d.tar.bz2 dotty-843f9769f5fc5572f06e058af65e43f81b8d432d.zip |
Two fixes in desugar
(1) set position of companion object def
(2) companions of case classes taking multiple parameter lists do not inherit from
a function type (reason: we can't straightforwardly converyt a curried method
with multiple parameter lists to a function value).
Diffstat (limited to 'src/dotty/tools/dotc/ast/Desugar.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/Desugar.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala index 855269a2f..705d14f03 100644 --- a/src/dotty/tools/dotc/ast/Desugar.scala +++ b/src/dotty/tools/dotc/ast/Desugar.scala @@ -324,7 +324,8 @@ object desugar { moduleDef( ModuleDef( Modifiers(Synthetic), name.toTermName, - Template(emptyConstructor, parentTpt :: Nil, EmptyValDef, defs))).toList + Template(emptyConstructor, parentTpt :: Nil, EmptyValDef, defs))) + .withPos(cdef.pos).toList // The companion object defifinitions, if a companion is needed, Nil otherwise. // companion definitions include: @@ -338,7 +339,8 @@ object desugar { val companions = if (mods is Case) { val parent = - if (constrTparams.nonEmpty) anyRef // todo: also use anyRef if constructor has a dependent method type (or rule that out)! + if (constrTparams.nonEmpty || constrVparamss.length > 1) anyRef + // todo: also use anyRef if constructor has a dependent method type (or rule that out)! else (constrVparamss :\ classTypeRef) ((vparams, restpe) => Function(vparams map (_.tpt), restpe)) val applyMeths = if (mods is Abstract) Nil |