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 953de75 commit 1fb3271Copy full SHA for 1fb3271
tests/pos/11463.scala
@@ -0,0 +1,11 @@
1
+type LeafElem[X] = X match
2
+ case String => Char
3
+ case Array[t] => LeafElem[t]
4
+ case Iterable[t] => LeafElem[t]
5
+ case AnyVal => X
6
+
7
+def leafElem[X](x: X): LeafElem[X] = x match
8
+ case x: String => x.charAt(0)
9
+ case x: Array[t] => leafElem(x(9))
10
+ case x: Iterable[t] => leafElem(x.head)
11
+ case x: AnyVal => x
0 commit comments