@@ -423,6 +423,7 @@ object Semantic {
423423 /** Error reporting */
424424 trait Reporter :
425425 def report (err : Error ): Unit
426+ def reportAll (errs : Seq [Error ]): Unit = for err <- errs do report(err)
426427
427428 object Reporter :
428429 class BufferedReporter extends Reporter :
@@ -600,7 +601,7 @@ object Semantic {
600601 }
601602
602603 def call (meth : Symbol , args : List [ArgInfo ], receiver : Type , superType : Type , needResolve : Boolean = true ): Contextual [Value ] = log(" call " + meth.show + " , args = " + args, printer, (_ : Value ).show) {
603- def checkArgs = args.foreach(_.promote)
604+ def promoteArgs () : Contextual [ Unit ] = args.foreach(_.promote)
604605
605606 def isSyntheticApply (meth : Symbol ) =
606607 meth.is(Flags .Synthetic )
@@ -648,16 +649,16 @@ object Semantic {
648649 if allArgsPromote then
649650 Hot : Value
650651 else if errors.nonEmpty then
651- for error <- errors do reporter.report(error )
652+ reporter.reportAll(errors )
652653 Hot : Value
653654 else
654655 Cold : Value
655656 else
656- checkArgs
657+ promoteArgs()
657658 Hot
658659
659660 case Cold =>
660- checkArgs
661+ promoteArgs()
661662 val error = CallCold (meth, trace.toVector)
662663 reporter.report(error)
663664 Hot
@@ -676,15 +677,15 @@ object Semantic {
676677 if target.hasSource then
677678 val cls = target.owner.enclosingClass.asClass
678679 val ddef = target.defTree.asInstanceOf [DefDef ]
679- val argErrors = Reporter .errorsIn { args.foreach(_.promote ) }
680+ val argErrors = Reporter .errorsIn { promoteArgs( ) }
680681 // normal method call
681682 if argErrors.nonEmpty && isSyntheticApply(meth) then
682683 val klass = meth.owner.companionClass.asClass
683684 val outerCls = klass.owner.lexicallyEnclosingClass.asClass
684685 val outer = resolveOuterSelect(outerCls, ref, 1 )
685686 outer.instantiate(klass, klass.primaryConstructor, args)
686687 else
687- for error <- argErrors do reporter.report(error )
688+ reporter.reportAll(argErrors )
688689 withEnv(if isLocal then env else Env .empty) {
689690 extendTrace(ddef) {
690691 eval(ddef.rhs, ref, cls, cacheResult = true )
@@ -694,7 +695,7 @@ object Semantic {
694695 Hot
695696 else
696697 // no source code available
697- checkArgs
698+ promoteArgs()
698699 val error = CallUnknown (target, trace.toVector)
699700 reporter.report(error)
700701 Hot
@@ -710,7 +711,7 @@ object Semantic {
710711 // meth == NoSymbol for poly functions
711712 if meth.name.toString == " tupled" then value // a call like `fun.tupled`
712713 else
713- checkArgs
714+ promoteArgs()
714715 withEnv(env) {
715716 eval(body, thisV, klass, cacheResult = true )
716717 }
@@ -932,7 +933,7 @@ object Semantic {
932933 promoted.add(warm)
933934 val errors = warm.tryPromote(msg)
934935 if errors.nonEmpty then promoted.remove(warm)
935- for error <- errors do reporter.report(error )
936+ reporter.reportAll(errors )
936937
937938 case fun @ Fun (body, thisV, klass, env) =>
938939 if ! promoted.contains(fun) then
0 commit comments