Skip to content

Commit dba3270

Browse files
committed
Fix validCtor
1 parent 97f7aa9 commit dba3270

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5965,8 +5965,15 @@ object Types extends TypeUtils {
59655965
case _ => false
59665966
def validCtor(cls: Symbol): Boolean =
59675967
val ctor = cls.primaryConstructor
5968-
(!ctor.exists || zeroParams(ctor.info)) // `ContextFunctionN` does not have constructors
5969-
&& (!cls.is(Trait) || validCtor(cls.info.parents.head.classSymbol))
5968+
if !ctor.exists then true // `ContextFunctionN` does not have constructors
5969+
else if !zeroParams(ctor.info) then false
5970+
else if !cls.is(Trait) then true
5971+
else
5972+
val firstParentCls = cls.info.parents.head.classSymbol
5973+
if firstParentCls.isClass && !firstParentCls.is(Trait) then
5974+
validCtor(firstParentCls) // need to check class constructor as well
5975+
else
5976+
true
59705977
val validCtorNEW = validCtor(tp.cls)
59715978

59725979
if validCtorNEW != validCtorOLD then

0 commit comments

Comments
 (0)