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 e081ccf commit cd0d0ebCopy full SHA for cd0d0eb
src/script/scala/progscala3/typesystem/matchtypes/DepTypedMethods.scala
@@ -8,7 +8,8 @@ type ElemR[X] = X match // "R" for "recursive"
8
case Option[t] => ElemR[t]
9
case AnyVal => X
10
11
-def first[X](x: X): ElemR[X] = x.asInstanceOf[Matchable & X] match // <3>
+import compiletime.asMatchable // <3>
12
+def first[X](x: X): ElemR[X] = x.asMatchable match // <4>
13
case s: String => s.charAt(0)
14
case a: Array[t] => first(a(0))
15
case i: Iterable[t] => first(i.head)
0 commit comments