@@ -5954,27 +5954,17 @@ object Types extends TypeUtils {
5954
5954
// `ContextFunctionN` does not have constructors
5955
5955
! ctor.exists || zeroParamsOLD(ctor.info)
5956
5956
5957
- def zeroParams (tp : Type ): Boolean = tp.stripPoly match
5958
- case mt : MethodType =>
5959
- val noArgsNeeded = mt.paramInfos match
5960
- case Nil => true
5961
- case info :: Nil => info.isRepeatedParam
5962
- case _ => false
5963
- noArgsNeeded && ! mt.resultType.isInstanceOf [MethodType ]
5964
- case et : ExprType => true
5965
- case _ => false
5966
5957
def takesNoArgs (tp : Type ) =
5967
- val constrs = tp.decl(nme.CONSTRUCTOR )
5968
- ! constrs.exists // `ContextFunctionN` does not have constructors
5969
- || constrs.hasAltWith(constr => zeroParams(constr.info))
5970
- def firstParentCls = cls.info.parents.head.classSymbol
5958
+ ! tp.classSymbol.primaryConstructor.exists // `ContextFunctionN` does not have constructors
5959
+ || tp.applicableConstructors(Nil , adaptVarargs = true ).nonEmpty
5960
+ def firstParentCls = tp.parents.head.classSymbol
5971
5961
val noArgsNeeded : Boolean =
5972
5962
takesNoArgs(tp)
5973
- && (! tp.cls.is(Trait ) || takesNoArgs(tp.cls.info. parents.head))
5963
+ && (! tp.cls.is(Trait ) || takesNoArgs(tp.parents.head))
5974
5964
5975
5965
if noArgsNeeded != validCtorOLD then
5976
5966
println(
5977
- i """ SAM change for $tp / ${tp.cls.fullName} with parent ${firstParentCls.fullName}, now $noArgsNeeded
5967
+ i """ SAM change for $tp with parent ${firstParentCls.fullName}, now $noArgsNeeded
5978
5968
|takesNoArgs: ${takesNoArgs(tp)}
5979
5969
|takesNoArgsParent: ${takesNoArgs(tp.cls.info.parents.head)}
5980
5970
|primary: ${firstParentCls.primaryConstructor.info}""" )
0 commit comments