You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code (here in Scastie) does not currently work:
sealedabstractclassMaybe[A]
finalcaseclassJust[A](a: A) extendsMaybe[A]
classEmpty[A] extendsMaybe[A]
objectEmpty {
defapply[A]():Maybe[A] =newEmpty[A]
// def unapply[A](e: Empty[A]): Boolean = true // okdefunapply[A](e: Empty[A]):true=true
}
objectTest {
vala:Maybe[Int] =Just(2)
defmain(args: Array[String]):Unit= a match {
caseJust(2) =>truecaseEmpty() =>// ^ Boolean(true) is not a valid result type of an unapply method of an extractor()
}
}
Though it should arguably compile and raise an exhaustivity warning (because it does not match Just(n) for n != 2).
The text was updated successfully, but these errors were encountered:
The following code (here in Scastie) does not currently work:
Though it should arguably compile and raise an exhaustivity warning (because it does not match
Just(n)
forn != 2
).The text was updated successfully, but these errors were encountered: