From 13885930bedd7065397f9a268d50dbdb8e8febd3 Mon Sep 17 00:00:00 2001 From: paltherr Date: Tue, 15 Jul 2003 12:29:30 +0000 Subject: - Removed "case TypeRef(...)" from method Type.... - Removed "case TypeRef(...)" from method Type.typeParams and Type.valueParams (fixes at least one bug in lambdalift). - Fixed code in Analyzer which relied on the "case TypeRef(...)" --- sources/scalac/symtab/Type.java | 15 +++++---------- sources/scalac/typechecker/Analyzer.java | 4 ++-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java index 45e32dfda3..61cd77c300 100644 --- a/sources/scalac/symtab/Type.java +++ b/sources/scalac/symtab/Type.java @@ -411,21 +411,19 @@ public class Type implements Modifiers, Kinds, TypeTags { } } - /** Get type parameters of polymorphic method or class - * or EMPTY_ARRAY if not applicable. + /** Get type parameters of polymorphic method or EMPTY_ARRAY if + * not applicable. */ public Symbol[] typeParams() { switch (this) { case PolyType(Symbol[] tparams, _): return tparams; - case TypeRef(_, Symbol sym, _): - if (sym.kind == CLASS) return sym.typeParams(); - else return sym.info().typeParams(); + default: + return Symbol.EMPTY_ARRAY; } - return Symbol.EMPTY_ARRAY; } - /** Get value parameters of method or class or EMPTY_ARRAY if not + /** Get value parameters of method or EMPTY_ARRAY if not * applicable. */ public Symbol[] valueParams() { @@ -434,9 +432,6 @@ public class Type implements Modifiers, Kinds, TypeTags { return result.valueParams(); case MethodType(Symbol[] vparams, _): return vparams; - case TypeRef(_, Symbol sym, _): - if (sym.kind == CLASS) return sym.valueParams(); - else return sym.info().valueParams(); default: return Symbol.EMPTY_ARRAY; } diff --git a/sources/scalac/typechecker/Analyzer.java b/sources/scalac/typechecker/Analyzer.java index e72365ab16..a5b55e18b2 100644 --- a/sources/scalac/typechecker/Analyzer.java +++ b/sources/scalac/typechecker/Analyzer.java @@ -2204,8 +2204,8 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { Type[] argtypes = Tree.typeOf(args); //todo: this needs to be refined. Symbol[] tparams = - (Type.isSameAs(tpe1.type.typeArgs(), Symbol.type(tpe1.type.typeParams()))) - ? tpe1.type.typeParams() + (Type.isSameAs(tpe1.type.typeArgs(), Symbol.type(tpe1.type.unalias().symbol().typeParams()))) + ? tpe1.type.unalias().symbol().typeParams() : Symbol.EMPTY_ARRAY; Type owntype = Type.ErrorType; if (tpe1.type != Type.ErrorType) { -- cgit v1.2.3