summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-02-27 22:55:17 +0000
committerMartin Odersky <odersky@gmail.com>2007-02-27 22:55:17 +0000
commite0dde41aec58c0025bd219bcc18ec6125dd39afa (patch)
tree68e51dd399d509cae86a9623baa2aa6cc3a80a34 /src
parent79e3814ced4b75b82f17f3b8a9c39b8e07256736 (diff)
downloadscala-e0dde41aec58c0025bd219bcc18ec6125dd39afa.tar.gz
scala-e0dde41aec58c0025bd219bcc18ec6125dd39afa.tar.bz2
scala-e0dde41aec58c0025bd219bcc18ec6125dd39afa.zip
fixed bug960
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala22
1 files changed, 3 insertions, 19 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index a61ab3a339..4c921da9c2 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1519,25 +1519,6 @@ trait Typers requires Analyzer {
if (args.length > MaxTupleArity)
error(fun.pos, "too many arguments for unapply pattern, maximum = "+MaxTupleArity)
val arg = Ident(argDummy) setType argDummyType
-/*
- var funPt: Type = null
- try {
- funPt = unapp.name match {
- case nme.unapply => unapplyReturnTypeExpected(args.length)
- case nme.unapplySeq => unapplyTypeListFromReturnTypeSeq(unappType) match {
- case List() => null //fail
- case List(TypeRef(pre,repeatedParam, tpe)) => optionType(seqType(WildcardType)) //succeed
- case xs => optionType(productType((xs.tail map {x => WildcardType}) ::: List(seqType(WildcardType))))// succeed
- }
- }
- } catch {
- case ex => //failure
- //Console.println("DEBUG")
- //ex.printStackTrace()
- error(fun.pos, " unapplySeq should return Option[T] for T<:Product?[...Seq[?]]")
- return setError(tree)
- }
-*/
val oldArgType = arg.tpe
if (!isApplicable(List(), unappType, List(arg.tpe), WildcardType)) {
//Console.println("UNAPP: need to typetest, arg.tpe = "+arg.tpe+", unappType = "+unappType)
@@ -1547,6 +1528,9 @@ trait Typers requires Analyzer {
case PolyType(tparams, restype) =>
val tparams1 = cloneSymbols(tparams)
(freshArgType(restype)._1.substSym(tparams, tparams1), tparams1)
+ case OverloadedType(_, _) =>
+ error(fun.pos, "cannot resolve overloaded unapply")
+ (ErrorType, List())
}
val (unappFormal, freeVars) = freshArgType(unappType)
val context1 = context.makeNewScope(context.tree, context.owner)