From d9c8ccce14bdd4f9364af4941cd47edbfec0c8ce Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Thu, 23 May 2013 21:23:25 +0200 Subject: SI-7509 Avoid crasher as erronous args flow through NamesDefaults The fix for SI-7238 caused this regression. This commit marks taints whole Apply with an ErrorType if it has an erroneous argument, so as to stop a later crash trying to further process the tree. --- src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala index f3736f1519..802df39f01 100644 --- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala +++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala @@ -333,9 +333,12 @@ trait NamesDefaults { self: Analyzer => // type the application without names; put the arguments in definition-site order val typedApp = doTypedApply(tree, funOnly, reorderArgs(namelessArgs, argPos), mode, pt) typedApp match { - // Extract the typed arguments, restore the call-site evaluation order (using - // ValDef's in the block), change the arguments to these local values. - case Apply(expr, typedArgs) if !(typedApp :: typedArgs).exists(_.isErrorTyped) => // bail out with erroneous args, see SI-7238 + case Apply(expr, typedArgs) if (typedApp :: typedArgs).exists(_.isErrorTyped) => + setError(tree) // bail out with and erroneous Apply *or* erroneous arguments, see SI-7238, SI-7509 + case Apply(expr, typedArgs) => + // Extract the typed arguments, restore the call-site evaluation order (using + // ValDef's in the block), change the arguments to these local values. + // typedArgs: definition-site order val formals = formalTypes(expr.tpe.paramTypes, typedArgs.length, removeByName = false, removeRepeated = false) // valDefs: call-site order -- cgit v1.2.3