From e54eb1a14945eb289159d202be63830d243ab723 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Fri, 23 Mar 2012 15:29:29 +0100 Subject: typedMatchAnonFun's missingCase call use apply's arg can't pass the scrutinee since its type has been widened --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala') diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index eecf36487c..d91b58be82 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2227,7 +2227,10 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { anonClass setInfo ClassInfoType(parents, newScope, anonClass) methodSym setInfoAndEnter MethodType(paramSyms, resTp) - val body = methodBodyTyper.translateMatch(selector1, selectorTp, casesAdapted, resTp, doTranslation, if (isPartial) Some(scrut => (funThis DOT nme.missingCase) (scrut)) else None) + // use apply's parameter since the scrut's type has been widened + def missingCase(scrut_ignored: Tree) = (funThis DOT nme.missingCase) (REF(paramSyms.head)) + + val body = methodBodyTyper.translateMatch(selector1, selectorTp, casesAdapted, resTp, doTranslation, if (isPartial) Some(missingCase) else None) DefDef(methodSym, body) } -- cgit v1.2.3