From 0988bfd2e373fdcc6ad81e7eff9afa73227e3bc9 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 5 Dec 2006 16:51:54 +0000 Subject: fixed bug 846. added debug output to unapply problem. --- src/compiler/scala/tools/nsc/symtab/Types.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index 23ba5df865..6207e93ee0 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -1926,7 +1926,7 @@ trait Types requires SymbolTable { sym1 == AllClass || // Console.println("last chance " + sym1 + " " + sym2 + " " + sym2.isClass + " " (sym2 isSubClass ObjectClass)) - sym1 == AllRefClass && sym2.isClass && (sym2 isSubClass ObjectClass)) + sym1 == AllRefClass && sym2.isClass && sym2 != AllClass && (sym2 isSubClass ObjectClass)) case Pair(MethodType(pts1, res1), MethodType(pts2, res2)) => (pts1.length == pts2.length && matchingParams(pts1, pts2, tp2.isInstanceOf[JavaMethodType]) && diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index c9db05b064..73adb07d23 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1427,8 +1427,11 @@ trait Typers requires Analyzer { val funPt = appliedType(OptionClass.typeConstructor, List(prod)) val fun0 = Ident(fun.symbol) setPos fun.pos setType otpe // would this change when patterns are terms??? - val fun1 = typed(atPos(fun.pos) { Apply(Select( - gen.mkAttributedRef(fun.tpe.prefix,fun.symbol), unapp), List(arg)) }, EXPRmode, funPt) + val fun1untyped = atPos(fun.pos) { + Apply(Select(gen.mkAttributedRef(fun.tpe.prefix,fun.symbol), unapp), List(arg)) + } + Console.println("UNAPP "+fun1untyped) + val fun1 = typed(fun1untyped, EXPRmode, funPt) if (fun1.tpe.isErroneous) setError(tree) else { val formals0 = if(unapp.name == nme.unapply) optionOfProductElems(fun1.tpe) @@ -2224,6 +2227,7 @@ trait Typers requires Analyzer { //Console.println("typing "+tree+", "+context.undetparams);//DEBUG val tree1 = if (tree.tpe ne null) tree else typed1(tree, mode, pt) //Console.println("typed "+tree1+":"+tree1.tpe+", "+context.undetparams);//DEBUG + val result = if (tree1.isEmpty) tree1 else adapt(tree1, mode, pt) //Console.println("adapted "+tree1+":"+tree1.tpe+" to "+pt+", "+context.undetparams);//DEBUG result -- cgit v1.2.3