diff options
author | Martin Odersky <odersky@gmail.com> | 2015-04-29 21:37:32 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-05-02 19:06:29 +0200 |
commit | a5eb07633581962289bf6ee32c2cc7de00333cf6 (patch) | |
tree | 2f5b7b493b75e8454e14dbfc5cfb9a17c71e581e /src/dotty/tools/dotc/ast/tpd.scala | |
parent | 0da6780f503c85064f7228b8f3866a0defe88221 (diff) | |
download | dotty-a5eb07633581962289bf6ee32c2cc7de00333cf6.tar.gz dotty-a5eb07633581962289bf6ee32c2cc7de00333cf6.tar.bz2 dotty-a5eb07633581962289bf6ee32c2cc7de00333cf6.zip |
Make tpd.ClassDef work for polymorphic parent classes.
The handling of the first parent of ClassDef was broken if
that parent had type parameters. This was exposed by following
commites which use ClassDef more intensively than before in
creating anonymous classes representing closures.
Diffstat (limited to 'src/dotty/tools/dotc/ast/tpd.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/tpd.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala index de0ef3344..23b964dc4 100644 --- a/src/dotty/tools/dotc/ast/tpd.scala +++ b/src/dotty/tools/dotc/ast/tpd.scala @@ -210,7 +210,8 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { ta.assignType(untpd.TypeDef(sym.name, TypeTree(sym.info)), sym) def ClassDef(cls: ClassSymbol, constr: DefDef, body: List[Tree], superArgs: List[Tree] = Nil)(implicit ctx: Context): TypeDef = { - val firstParent :: otherParents = cls.info.parents + val firstParentRef :: otherParentRefs = cls.info.parents + val firstParent = cls.typeRef.baseTypeWithArgs(firstParentRef.symbol) val superRef = if (cls is Trait) TypeTree(firstParent) else { @@ -225,7 +226,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { val constr = firstParent.decl(nme.CONSTRUCTOR).suchThat(constr => isApplicable(constr.info)) New(firstParent, constr.symbol.asTerm, superArgs) } - val parents = superRef :: otherParents.map(TypeTree(_)) + val parents = superRef :: otherParentRefs.map(TypeTree(_)) val selfType = if (cls.classInfo.selfInfo ne NoType) ValDef(ctx.newSelfSym(cls)) |