Skip to content

Commit dbe5c27

Browse files
committed
Fix check of constructor params
`ImplicitFunctionN` does not have constructors
1 parent edd6653 commit dbe5c27

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4516,9 +4516,11 @@ object Types {
45164516
def zeroParams(tp: Type): Boolean = tp.stripPoly match {
45174517
case mt: MethodType => mt.paramInfos.isEmpty && !mt.resultType.isInstanceOf[MethodType]
45184518
case et: ExprType => true
4519-
case _ => false
4519+
case tp => false
45204520
}
4521-
if (zeroParams(tp.cls.primaryConstructor.info)) tp
4521+
// `ImplicitFunctionN` does not have constructors
4522+
val ctor = tp.cls.primaryConstructor
4523+
if (!ctor.exists || zeroParams(ctor.info)) tp
45224524
else NoType
45234525
case tp: AppliedType =>
45244526
zeroParamClass(tp.superType)

0 commit comments

Comments
 (0)