@@ -615,11 +615,11 @@ object Semantic {
615615
616616 def checkArgsWithParametricity () =
617617 val methodType = atPhaseBeforeTransforms { meth.info.stripPoly }
618- var allArgsPromote = true
618+ var allArgsHot = true
619619 val allParamTypes = methodType.paramInfoss.flatten.map(_.repeatedToSingle)
620620 val errors = allParamTypes.zip(args).flatMap { (info, arg) =>
621621 val errors = Reporter .errorsIn { arg.promote }
622- allArgsPromote = allArgsPromote && errors.isEmpty
622+ allArgsHot = allArgsHot && errors.isEmpty
623623 info match
624624 case typeParamRef : TypeParamRef =>
625625 val bounds = typeParamRef.underlying.bounds
@@ -632,21 +632,21 @@ object Semantic {
632632 if isWithinBounds && ! otherParamContains then Nil else errors
633633 case _ => errors
634634 }
635- (errors, allArgsPromote )
635+ (errors, allArgsHot )
636636
637637 // fast track if the current object is already initialized
638638 if promoted.isCurrentObjectPromoted then Hot
639639 else if isAlwaysSafe(meth) then Hot
640640 else if meth eq defn.Any_asInstanceOf then value
641641 else value match {
642642 case Hot =>
643- if isSyntheticApply(meth) then
643+ if isSyntheticApply(meth) && meth.hasSource then
644644 val klass = meth.owner.companionClass.asClass
645645 instantiate(klass, klass.primaryConstructor, args)
646646 else
647647 if receiver.typeSymbol.isStaticOwner then
648- val (errors, allArgsPromote ) = checkArgsWithParametricity()
649- if allArgsPromote then
648+ val (errors, allArgsHot ) = checkArgsWithParametricity()
649+ if allArgsHot then
650650 Hot : Value
651651 else if errors.nonEmpty then
652652 reporter.reportAll(errors)
0 commit comments