Skip to content

Commit 7ccc244

Browse files
committed
Fix companion parents for enum case
In the case where an enum case contains an extends clause whose type is not fully specified, we cannot generate a function type parent for the companion object. In fact, this business of generating function types as parents of case class companions is getting more and more fragile. We should maybe get out of it altogether.
1 parent 8712559 commit 7ccc244

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,8 @@ object desugar {
598598
if (constrTparams.nonEmpty ||
599599
constrVparamss.length > 1 ||
600600
mods.is(Abstract) ||
601-
restrictedAccess) anyRef
601+
restrictedAccess ||
602+
isEnumCase && applyResultTpt.isEmpty) anyRef
602603
else
603604
// todo: also use anyRef if constructor has a dependent method type (or rule that out)!
604605
(constrVparamss :\ (if (isEnumCase) applyResultTpt else classTypeRef)) (

0 commit comments

Comments
 (0)