Skip to content

Commit

Permalink
Fix validCtor
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Sep 16, 2024
1 parent 97f7aa9 commit dba3270
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5965,8 +5965,15 @@ object Types extends TypeUtils {
case _ => false
def validCtor(cls: Symbol): Boolean =
val ctor = cls.primaryConstructor
(!ctor.exists || zeroParams(ctor.info)) // `ContextFunctionN` does not have constructors
&& (!cls.is(Trait) || validCtor(cls.info.parents.head.classSymbol))
if !ctor.exists then true // `ContextFunctionN` does not have constructors
else if !zeroParams(ctor.info) then false
else if !cls.is(Trait) then true
else
val firstParentCls = cls.info.parents.head.classSymbol
if firstParentCls.isClass && !firstParentCls.is(Trait) then
validCtor(firstParentCls) // need to check class constructor as well
else
true
val validCtorNEW = validCtor(tp.cls)

if validCtorNEW != validCtorOLD then
Expand Down

0 comments on commit dba3270

Please sign in to comment.