diff options
author | Martin Odersky <odersky@gmail.com> | 2003-07-31 09:57:59 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2003-07-31 09:57:59 +0000 |
commit | 03449ed20a3cca9e8d974c7efeff6b4e01ecb66d (patch) | |
tree | db1153ac4bffac098d6d6d053f727992f1a2e4da /sources/scalac/ast/TreeGen.java | |
parent | be21ca1267f48e8fd14d5e32f3c7a4d814005eef (diff) | |
download | scala-03449ed20a3cca9e8d974c7efeff6b4e01ecb66d.tar.gz scala-03449ed20a3cca9e8d974c7efeff6b4e01ecb66d.tar.bz2 scala-03449ed20a3cca9e8d974c7efeff6b4e01ecb66d.zip |
*** empty log message ***
Diffstat (limited to 'sources/scalac/ast/TreeGen.java')
-rw-r--r-- | sources/scalac/ast/TreeGen.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sources/scalac/ast/TreeGen.java b/sources/scalac/ast/TreeGen.java index f890a63a61..051c067b5a 100644 --- a/sources/scalac/ast/TreeGen.java +++ b/sources/scalac/ast/TreeGen.java @@ -188,7 +188,12 @@ public class TreeGen implements Kinds, Modifiers { public Tree mkParentConstr(int pos, Type parentType, Tree[] parentArgs) { switch (parentType) { case TypeRef(Type pre, Symbol sym, Type[] args): - Tree ref = mkRef(pos, pre, sym.constructor()); + Tree ref = mkRef(pos, pre, sym.allConstructors()); + switch (ref.type) { + case OverloadedType(Symbol[] alts, Type[] alttypes): + infer.methodAlternative( + ref, alts, alttypes, Tree.typeOf(parentArgs), Type.AnyType); + } Tree constr = (args.length == 0) ? ref : TypeApply(ref, mkTypes(sym.pos, args)); return Apply(constr, parentArgs); @@ -206,14 +211,14 @@ public class TreeGen implements Kinds, Modifiers { public Tree[] mkParentConstrs(int pos, Type[] parents, Tree[][] parentArgs) { Tree[] constrs = new Tree[parents.length]; for (int i = 0; i < parents.length; ++i) - constrs[i] = (parentArgs == null ? + constrs[i] = (parentArgs.length == 0 ? mkParentConstr(pos, parents[i]) - : mkParentConstr(pos, parents[i], parentArgs[i])); + : mkParentConstr(pos, parents[i], parentArgs[i])); return constrs; } public Tree[] mkParentConstrs(int pos, Type[] parents) { - return mkParentConstrs(pos, parents, null); + return mkParentConstrs(pos, parents, new Tree[][]{}); } /** Build parameter sections corresponding to type. @@ -344,7 +349,7 @@ public class TreeGen implements Kinds, Modifiers { */ public Tree New(int pos, Type pre, Symbol clazz, Type[] targs, Tree[] args) { - Tree constr = mkRef(pos, pre, clazz.constructor()); + Tree constr = mkRef(pos, pre, clazz.primaryConstructor()); if (targs.length != 0) constr = TypeApply(constr, mkTypes(pos, targs)); Tree base = Apply(constr, args); @@ -511,7 +516,7 @@ public class TreeGen implements Kinds, Modifiers { */ public Tree ClassDef(int pos, Symbol clazz, Template template) { Global.instance.nextPhase(); - Type constrtype = clazz.constructor().info(); + Type constrtype = clazz.primaryConstructor().info(); Global.instance.prevPhase(); return make.ClassDef( pos, @@ -615,7 +620,7 @@ public class TreeGen implements Kinds, Modifiers { pos, Names.ANON_CLASS_NAME.toTypeName(), owner, 0); clazz.setInfo(Type.compoundType(new Type[]{definitions.OBJECT_TYPE, ft}, new Scope(), clazz)); - clazz.constructor().setInfo( + clazz.allConstructors().setInfo( Type.MethodType(Symbol.EMPTY_ARRAY, clazz.typeConstructor())); Symbol applyMeth = new TermSymbol(pos, Names.apply, clazz, FINAL) @@ -639,7 +644,7 @@ public class TreeGen implements Kinds, Modifiers { pos, Names.ANON_CLASS_NAME.toTypeName(), owner, 0); clazz.setInfo(Type.compoundType(new Type[]{definitions.OBJECT_TYPE, pft}, new Scope(), clazz)); - clazz.constructor().setInfo( + clazz.allConstructors().setInfo( Type.MethodType(Symbol.EMPTY_ARRAY, clazz.typeConstructor())); Tree classDef = ClassDef(clazz, new Tree[]{ |