aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/ast/tpd.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-02-02 16:38:27 +1100
committerMartin Odersky <odersky@gmail.com>2017-02-08 22:20:26 +1100
commit0f396544ced68ca2548b204527e2325c3fc65135 (patch)
treeb88c6f374a1f510d5ffdc41996a216c489844daa /compiler/src/dotty/tools/dotc/ast/tpd.scala
parent97b0a084f4490a0e5cc3c7a02d18647e7fa89330 (diff)
downloaddotty-0f396544ced68ca2548b204527e2325c3fc65135.tar.gz
dotty-0f396544ced68ca2548b204527e2325c3fc65135.tar.bz2
dotty-0f396544ced68ca2548b204527e2325c3fc65135.zip
Refine AnonClass generation
The leading class should be the superclass of the first trait (which is not always Object). We could think of a more refined condition, (i.e. taking the least common superclass of all extended traits), but I think it's not worth it, as one can always spell out the right superclass manually.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/ast/tpd.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/ast/tpd.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/ast/tpd.scala b/compiler/src/dotty/tools/dotc/ast/tpd.scala
index 565ec5ce2..ed268fda7 100644
--- a/compiler/src/dotty/tools/dotc/ast/tpd.scala
+++ b/compiler/src/dotty/tools/dotc/ast/tpd.scala
@@ -260,7 +260,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
def AnonClass(parents: List[Type], fns: List[TermSymbol], methNames: List[TermName])(implicit ctx: Context): Block = {
val owner = fns.head.owner
val parents1 =
- if (parents.head.classSymbol.is(Trait)) defn.ObjectType :: parents
+ if (parents.head.classSymbol.is(Trait)) parents.head.parents.head :: parents
else parents
val cls = ctx.newNormalizedClassSymbol(owner, tpnme.ANON_FUN, Synthetic, parents1,
coord = fns.map(_.pos).reduceLeft(_ union _))