@@ -571,7 +571,7 @@ trait Applications extends Compatibility {
571
571
fail(TypeMismatch (methType.resultType, resultType, None ))
572
572
573
573
// match all arguments with corresponding formal parameters
574
- matchArgs(orderedArgs, methType.paramInfos, 0 )
574
+ if success then matchArgs(orderedArgs, methType.paramInfos, 0 )
575
575
case _ =>
576
576
if (methType.isError) ok = false
577
577
else fail(em " $methString does not take parameters " )
@@ -666,7 +666,7 @@ trait Applications extends Compatibility {
666
666
* @param n The position of the first parameter in formals in `methType`.
667
667
*/
668
668
def matchArgs (args : List [Arg ], formals : List [Type ], n : Int ): Unit =
669
- if (success) formals match {
669
+ formals match {
670
670
case formal :: formals1 =>
671
671
672
672
def checkNoVarArg (arg : Arg ) =
@@ -878,7 +878,9 @@ trait Applications extends Compatibility {
878
878
init()
879
879
880
880
def addArg (arg : Tree , formal : Type ): Unit =
881
- typedArgBuf += adapt(arg, formal.widenExpr)
881
+ val typedArg = adapt(arg, formal.widenExpr)
882
+ typedArgBuf += typedArg
883
+ ok = ok & ! typedArg.tpe.isError
882
884
883
885
def makeVarArg (n : Int , elemFormal : Type ): Unit = {
884
886
val args = typedArgBuf.takeRight(n).toList
@@ -943,7 +945,7 @@ trait Applications extends Compatibility {
943
945
var typedArgs = typedArgBuf.toList
944
946
def app0 = cpy.Apply (app)(normalizedFun, typedArgs) // needs to be a `def` because typedArgs can change later
945
947
val app1 =
946
- if ( ! success || typedArgs.exists(_.tpe.isError)) app0.withType(UnspecifiedErrorType )
948
+ if ! success then app0.withType(UnspecifiedErrorType )
947
949
else {
948
950
if isJavaAnnotConstr(methRef.symbol) then
949
951
// #19951 Make sure all arguments are NamedArgs for Java annotations
0 commit comments