summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-07-10 17:48:47 +0000
committerMartin Odersky <odersky@gmail.com>2006-07-10 17:48:47 +0000
commit6865be2978bf34899c26c8bf2a1bcab1e4b89417 (patch)
tree0cd8e7749ea584378f3c0eeb348f7dd3bb3bad3f /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent4b1eef7cf470497d578f74838c8be3c02ef73a66 (diff)
downloadscala-6865be2978bf34899c26c8bf2a1bcab1e4b89417.tar.gz
scala-6865be2978bf34899c26c8bf2a1bcab1e4b89417.tar.bz2
scala-6865be2978bf34899c26c8bf2a1bcab1e4b89417.zip
fixed bug650
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala45
1 files changed, 15 insertions, 30 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 1e663af07f..5cc654e6c8 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -528,25 +528,6 @@ trait Typers requires Analyzer {
tree.tpe
}
-/*
- def completeParentType(tpt: Tree, templ: Template): Tree =
- if (tpt.hasSymbol) {
- val tparams = tpt.symbol.typeParams
- if (!tparams.isEmpty) {
- val constr @ DefDef(_, _, _, vparamss, _, rhs) = treeInfo.firstConstructor(templ.body)
- val Apply(_, superargs) = treeInfo.superCall(rhs, tpt.symbol.name)
- val outercontext = context.outer
- TypeTree(
- newTyper(outercontext.makeNewScope(constr, outercontext.owner))
- .completeParentType(
- tpt,
- tparams,
- context.owner.unsafeTypeParams,
- vparamss map (.map(.duplicate.asInstanceOf[ValDef])),
- superargs map (.duplicate))) setPos tpt.pos
- } else tpt
- } else tpt
-*/
def parentTypes(templ: Template): List[Tree] = try {
if (templ.parents.isEmpty) List()
else {
@@ -560,17 +541,21 @@ trait Typers requires Analyzer {
if (supertpt.hasSymbol) {
val tparams = supertpt.symbol.typeParams
if (!tparams.isEmpty) {
- val constr @ DefDef(_, _, _, vparamss, _, Apply(_, superargs)) =
- treeInfo.firstConstructor(templ.body)
- val outercontext = context.outer
- supertpt = TypeTree(
- newTyper(outercontext.makeNewScope(constr, outercontext.owner))
- .completeParentType(
- supertpt,
- tparams,
- context.owner.unsafeTypeParams,
- vparamss map (.map(.duplicate.asInstanceOf[ValDef])),
- superargs map (.duplicate))) setOriginal supertpt /* setPos supertpt.pos */
+ val constr = treeInfo.firstConstructor(templ.body)
+ constr match {
+ case EmptyTree =>
+ error(supertpt.pos, "missing type arguments")
+ case DefDef(_, _, _, vparamss, _, Apply(_, superargs)) =>
+ val outercontext = context.outer
+ supertpt = TypeTree(
+ newTyper(outercontext.makeNewScope(constr, outercontext.owner))
+ .completeParentType(
+ supertpt,
+ tparams,
+ context.owner.unsafeTypeParams,
+ vparamss map (.map(.duplicate.asInstanceOf[ValDef])),
+ superargs map (.duplicate))) setOriginal supertpt /* setPos supertpt.pos */
+ }
}
}
//System.out.println("parents("+context.owner+") = "+supertpt :: mixins);//DEBUG