Skip to content

Commit 80fdbb8

Browse files
dwijnandtgodzik
authored andcommitted
Avoid inf recursion in provablyDisjointClasses
1 parent e2ee55f commit 80fdbb8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/pos/i22266.scala

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
sealed trait NonPolygon
2+
sealed trait Polygon
3+
4+
sealed trait SymmetryAspect
5+
sealed trait RotationalSymmetry extends SymmetryAspect
6+
sealed trait MaybeRotationalSymmetry extends SymmetryAspect
7+
8+
enum Shape:
9+
case Circle extends Shape with NonPolygon with RotationalSymmetry
10+
case Triangle extends Shape with Polygon with MaybeRotationalSymmetry
11+
case Square extends Shape with Polygon with RotationalSymmetry
12+
13+
object Shape:
14+
15+
def hasPolygon(
16+
rotationalSyms: Vector[Shape & RotationalSymmetry],
17+
maybeSyms: Vector[Shape & MaybeRotationalSymmetry]
18+
): Boolean =
19+
val all = rotationalSyms.concat(maybeSyms)
20+
all.exists:
21+
case _: Polygon => true
22+
case _ => false

0 commit comments

Comments
 (0)