@@ -615,11 +615,11 @@ object Semantic {
615
615
616
616
def checkArgsWithParametricity () =
617
617
val methodType = atPhaseBeforeTransforms { meth.info.stripPoly }
618
- var allArgsPromote = true
618
+ var allArgsHot = true
619
619
val allParamTypes = methodType.paramInfoss.flatten.map(_.repeatedToSingle)
620
620
val errors = allParamTypes.zip(args).flatMap { (info, arg) =>
621
621
val errors = Reporter .errorsIn { arg.promote }
622
- allArgsPromote = allArgsPromote && errors.isEmpty
622
+ allArgsHot = allArgsHot && errors.isEmpty
623
623
info match
624
624
case typeParamRef : TypeParamRef =>
625
625
val bounds = typeParamRef.underlying.bounds
@@ -632,21 +632,21 @@ object Semantic {
632
632
if isWithinBounds && ! otherParamContains then Nil else errors
633
633
case _ => errors
634
634
}
635
- (errors, allArgsPromote )
635
+ (errors, allArgsHot )
636
636
637
637
// fast track if the current object is already initialized
638
638
if promoted.isCurrentObjectPromoted then Hot
639
639
else if isAlwaysSafe(meth) then Hot
640
640
else if meth eq defn.Any_asInstanceOf then value
641
641
else value match {
642
642
case Hot =>
643
- if isSyntheticApply(meth) then
643
+ if isSyntheticApply(meth) && meth.hasSource then
644
644
val klass = meth.owner.companionClass.asClass
645
645
instantiate(klass, klass.primaryConstructor, args)
646
646
else
647
647
if receiver.typeSymbol.isStaticOwner then
648
- val (errors, allArgsPromote ) = checkArgsWithParametricity()
649
- if allArgsPromote then
648
+ val (errors, allArgsHot ) = checkArgsWithParametricity()
649
+ if allArgsHot then
650
650
Hot : Value
651
651
else if errors.nonEmpty then
652
652
reporter.reportAll(errors)
0 commit comments