diff options
author | schinz <schinz@epfl.ch> | 2003-06-27 15:00:16 +0000 |
---|---|---|
committer | schinz <schinz@epfl.ch> | 2003-06-27 15:00:16 +0000 |
commit | 1a094d97cbc24536c2508a99e9f02b1ca8ec974e (patch) | |
tree | cc6f6e57b1695a5820cbcbf7f08fc629ed4b8d3b | |
parent | f03a35b6c3c57bc7084fc3d329dd1c6ba04e23d8 (diff) | |
download | scala-1a094d97cbc24536c2508a99e9f02b1ca8ec974e.tar.gz scala-1a094d97cbc24536c2508a99e9f02b1ca8ec974e.tar.bz2 scala-1a094d97cbc24536c2508a99e9f02b1ca8ec974e.zip |
- bug fix: make sure that the types of mixed-in...
- bug fix: make sure that the types of mixed-in things are correct, i.e.
seen from the host class (thanks to Matthias for suggesting this fix)
-rw-r--r-- | sources/scalac/transformer/ExpandMixins.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sources/scalac/transformer/ExpandMixins.java b/sources/scalac/transformer/ExpandMixins.java index d0f4c6510f..0cb5638ceb 100644 --- a/sources/scalac/transformer/ExpandMixins.java +++ b/sources/scalac/transformer/ExpandMixins.java @@ -141,7 +141,7 @@ public class ExpandMixins extends Transformer { return (Template)expansions.get(tree); } - protected Template expandMixins(Template tree, Symbol owner) { + protected Template expandMixins(Template tree, final Symbol owner) { Type templType = owner.info(); List/*<Tree>*/ newBody = new ArrayList(); @@ -171,7 +171,7 @@ public class ExpandMixins extends Transformer { for (int bcIndex = tree.parents.length - 1; bcIndex > 0; --bcIndex) { Tree bc = tree.parents[bcIndex]; - Symbol bcSym = baseTypes[bcIndex].symbol(); + final Symbol bcSym = baseTypes[bcIndex].symbol(); if ((bcSym.flags & Modifiers.INTERFACE) != 0) continue; @@ -189,7 +189,9 @@ public class ExpandMixins extends Transformer { assert tpFormals.length == tpActuals.length; Type.Map typeMap = new Type.Map() { public Type apply(Type t) { - return t.subst(tpFormals, tpActuals); + Type t1 = t.asSeenFrom(owner.thisType(), bcSym); + Type t2 = t1.subst(tpFormals, tpActuals); + return t2; } }; @@ -252,7 +254,6 @@ public class ExpandMixins extends Transformer { } // Pass 2: copy members - treeCopier.pushThisTypeSubst(bcSym, owner); for (int m = 0; m < mixinBody.length; ++m) { Tree member = mixinBody[m]; @@ -260,9 +261,9 @@ public class ExpandMixins extends Transformer { continue; treeCopier.pushSymbolSubst(symbolMap); - treeCopier.pushTypeSubst(tpFormals, tpActuals); + treeCopier.setTypeMap(typeMap); Tree newMember = treeCopier.copy(member); - treeCopier.popTypeSubst(); + treeCopier.clearTypeMap(); treeCopier.popSymbolSubst(); newBody.add(newMember); @@ -276,7 +277,6 @@ public class ExpandMixins extends Transformer { mixedInSymbols.put(member.symbol(), newMember.symbol()); } } - treeCopier.popThisTypeSubst(); } // Modify mixin base classes to refer to interfaces instead of |