-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
Currently, we can't write the : Int part of
expr match {
case Cons(x: Int, _) => x // doesn't parse, "Expected ) but got :"
...
}similarly, we can't use it in if (expr is Some(x: String)) and val Some(b: Bool) = expr.
This is especially annoying for tuple parameters
// argument list works
def f { g: (Int, String) => Unit }: Unit = g(0, "")
f { (x: Int, y) => () } // works (and reports an error if the annotation is wrong)
// tuple does not
def f { g: ((Int, String)) => Unit }: Unit = g((0, ""))
f { case (x: Int, y) => () } // doesn't parse, "Expected ) but got :"However, I do not want to use it for runtime matching like in Scala:
// not this, please
expr match {
case n: Int => ...
case s: String => ...
case _ => panic("ohno")
}Reactions are currently unavailable