summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-11-17 20:24:21 +0000
committerMartin Odersky <odersky@gmail.com>2007-11-17 20:24:21 +0000
commitac55b8a3c32eb837080e7f39fa3eeeb68a5e2014 (patch)
tree1036bb63198fe4ac5d4c750ac53df4986c3f5a76 /src/compiler
parent3818b76a0d280d28316b1607698163c8da4f7a67 (diff)
downloadscala-ac55b8a3c32eb837080e7f39fa3eeeb68a5e2014.tar.gz
scala-ac55b8a3c32eb837080e7f39fa3eeeb68a5e2014.tar.bz2
scala-ac55b8a3c32eb837080e7f39fa3eeeb68a5e2014.zip
Fixed #214, #217, #218
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala1
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala10
2 files changed, 5 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 832c9aef8d..25c34bcce8 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -2036,6 +2036,7 @@ A type's typeSymbol should never be inspected directly.
tp1 match {
case TypeRef(pre, sym, args) if (variance != 0) && (occurCount isDefinedAt sym) =>
val repl = if (variance == 1) dropSingletonType(tp1.bounds.hi) else tp1.bounds.lo
+ //println("eliminate "+sym+"/"+repl+"/"+occurCount(sym)+"/"+(tparams exists (repl.contains)))//DEBUG
if (repl.typeSymbol != AllClass && repl.typeSymbol != AllRefClass &&
occurCount(sym) == 1 && !(tparams exists (repl.contains))) repl
else tp1
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 6340b9bafd..96f7c4be4d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1419,7 +1419,7 @@ trait Typers { self: Analyzer =>
||
pt.typeSymbol == PartialFunctionClass &&
fun.vparams.length == 1 && fun.body.isInstanceOf[Match])
- && // see bug901 for a reason why next conditions are neeed
+ && // see bug901 for a reason why next conditions are neeed
(pt.normalize.typeArgs.length - 1 == fun.vparams.length
||
fun.vparams.exists(_.tpt.isEmpty)))
@@ -1435,10 +1435,8 @@ trait Typers { self: Analyzer =>
val vparamSyms = List.map2(fun.vparams, argpts) { (vparam, argpt) =>
if (vparam.tpt.isEmpty)
vparam.tpt.tpe =
- if (argpt == NoType || argpt == WildcardType) {
- error(vparam.pos, "missing parameter type"); ErrorType
- }
- else argpt
+ if (isFullyDefined(argpt)) argpt
+ else { error(vparam.pos, "missing parameter type"); ErrorType }
enterSym(context, vparam)
if (context.retyping) context.scope enter vparam.symbol
vparam.symbol
@@ -2165,7 +2163,7 @@ trait Typers { self: Analyzer =>
.setOriginal(tpt1) /* .setPos(tpt1.pos) */
.setType(appliedType(tpt1.tpe, context.undetparams map (_.tpe)))
}
- if (tpt1.tpe.typeSymbol hasFlag ABSTRACT)
+ if (!tpt1.tpe.typeSymbol.isClass || (tpt1.tpe.typeSymbol hasFlag ABSTRACT))
error(tree.pos, tpt1.tpe.typeSymbol + " is abstract; cannot be instantiated")
else if (tpt1.tpe.typeSymbol.thisSym != tpt1.tpe.typeSymbol &&
!(tpt1.tpe <:< tpt1.tpe.typeOfThis) &&