diff options
author | Martin Odersky <odersky@gmail.com> | 2005-10-05 09:10:59 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2005-10-05 09:10:59 +0000 |
commit | add8bf8d68f06468e9bd07f1a6cb4146dd5fd843 (patch) | |
tree | d557dddb4bc55d4da20e1237a0176e8d95d52555 /sources/scala/tools/nsc/typechecker/Typers.scala | |
parent | 85218bf8a66bc8807f57cf5225728ac9f748ca40 (diff) | |
download | scala-add8bf8d68f06468e9bd07f1a6cb4146dd5fd843.tar.gz scala-add8bf8d68f06468e9bd07f1a6cb4146dd5fd843.tar.bz2 scala-add8bf8d68f06468e9bd07f1a6cb4146dd5fd843.zip |
*** empty log message ***
Diffstat (limited to 'sources/scala/tools/nsc/typechecker/Typers.scala')
-rwxr-xr-x | sources/scala/tools/nsc/typechecker/Typers.scala | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sources/scala/tools/nsc/typechecker/Typers.scala b/sources/scala/tools/nsc/typechecker/Typers.scala index b4a585ed65..d53bd9049f 100755 --- a/sources/scala/tools/nsc/typechecker/Typers.scala +++ b/sources/scala/tools/nsc/typechecker/Typers.scala @@ -1295,7 +1295,7 @@ import collection.mutable.HashMap; if (name == nme.WILDCARD && (mode & (PATTERNmode | FUNmode)) == PATTERNmode) tree setType pt else - typedIdent(name); + typedIdent(name) // todo: try with case Literal(Constant(())) case Literal(value) => @@ -1321,17 +1321,20 @@ import collection.mutable.HashMap; } case AppliedTypeTree(tpt, args) => - val tpt1 = typed(tpt, mode | FUNmode | TAPPmode, WildcardType); - val tparams = tpt1.tpe.symbol.typeParams; + val tpt1 = typed1(tpt, mode | FUNmode | TAPPmode, WildcardType); + val tparams = tpt1.symbol.typeParams; val args1 = List.mapConserve(args)(typedType); - if (tpt1.tpe.isError) + if (tpt1.tpe.isError) { setError(tree) - else if (tparams.length == args1.length) - TypeTree() setPos tree.pos setType appliedType(tpt1.tpe, args1 map (.tpe)) - else if (tparams.length == 0) + } else if (tparams.length == args1.length) { + val argtypes = args1 map (.tpe); + val owntype = if (tpt1.symbol.isClass) appliedType(tpt1.tpe, argtypes) + else tpt1.tpe.subst(tparams, argtypes); + TypeTree() setPos tree.pos setType owntype + } else if (tparams.length == 0) { errorTree(tree, "" + tpt1.tpe + " does not take type parameters") - else { - System.out.println(tpt1.tpe.symbol.rawInfo);//debug + } else { + System.out.println("" + tpt1 + ":" + tpt1.symbol + ":" + tpt1.symbol.info);//debug errorTree(tree, "wrong number of type arguments for " + tpt1.tpe + ", should be " + tparams.length) } } |