We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e2ee55f commit 80fdbb8Copy full SHA for 80fdbb8
tests/pos/i22266.scala
@@ -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