diff options
author | paltherr <paltherr@epfl.ch> | 2003-09-10 12:31:52 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-09-10 12:31:52 +0000 |
commit | 9b9e16dd39fc866752e907c1a9fcfcb2dcde7fd8 (patch) | |
tree | 82986e335043c2f6942b0a97133fdf8b6206423e | |
parent | 636ded2b489333ecd7064d95af2b121d7d1a7009 (diff) | |
download | scala-9b9e16dd39fc866752e907c1a9fcfcb2dcde7fd8.tar.gz scala-9b9e16dd39fc866752e907c1a9fcfcb2dcde7fd8.tar.bz2 scala-9b9e16dd39fc866752e907c1a9fcfcb2dcde7fd8.zip |
- Fixed computation of outer type parameters
-rw-r--r-- | sources/scalac/transformer/ExplicitOuterClassesPhase.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sources/scalac/transformer/ExplicitOuterClassesPhase.java b/sources/scalac/transformer/ExplicitOuterClassesPhase.java index b0d48eb701..3812e1d708 100644 --- a/sources/scalac/transformer/ExplicitOuterClassesPhase.java +++ b/sources/scalac/transformer/ExplicitOuterClassesPhase.java @@ -74,7 +74,7 @@ public class ExplicitOuterClassesPhase extends Phase { } // Add outer type links if (hasOuterTypeLinks(symbol)) { - Symbol[] oldtparams = nextTypeParams(getOuterClass(symbol)); + Symbol[] oldtparams = getOuterTypeParams(symbol); Symbol[] tlinks = Symbol.cloneArray(oldtparams); for (int i = 0; i < tlinks.length; i++) { tlinks[i] = oldtparams[i].cloneSymbol(symbol); @@ -150,13 +150,24 @@ public class ExplicitOuterClassesPhase extends Phase { /** Returns the type substitution for the given class or constructor. */ private Type.Map getOuterTypeSubst(Symbol symbol, boolean update) { if (!hasOuterTypeLinks(symbol)) return Type.IdMap; - Symbol[] oldtparams = nextTypeParams(getOuterClass(symbol)); + Symbol[] oldtparams = getOuterTypeParams(symbol); Symbol[] newtparams = nextTypeParams(symbol); Symbol[] tlinks = new Symbol[oldtparams.length]; for (int i = 0; i < tlinks.length; i++) tlinks[i] = newtparams[i]; return Type.getSubst(oldtparams, tlinks, update); } + /** Returns the outer type parameters of the given class or constructor. */ + private Symbol[] getOuterTypeParams(Symbol symbol) { + Symbol outer = getOuterClass(symbol); + Symbol[] tparams = Symbol.cloneArray(nextTypeParams(outer)); + for (int i = tparams.length; i != 0; outer = getOuterClass(outer)) { + Symbol[] symbols = outer.typeParams(); + for (int j = symbols.length; j != 0; ) tparams[--i] = symbols[--j]; + } + return tparams; + } + /** * Extracts from given prefix the outer type arguments for the * given class or constructor. |