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 syntactical precedence of match expressions has been changed.
7
+
`match` is still a keyword, but it is used like an alphabetical operator. This has several consequences:
8
+
9
+
1.`match` expressions can be chained:
10
+
11
+
```scala
12
+
xs match {
13
+
caseNil=>"empty"
14
+
case x :: xs1 =>"nonempty"
15
+
} match {
16
+
case"empty"=>0
17
+
case"nonempty"=>1
18
+
}
19
+
20
+
2. `match` may follow a period:
21
+
22
+
```scala
23
+
if xsDefined
24
+
&& xs.match {
25
+
caseNil=>false
26
+
case _ =>true
27
+
}
28
+
then"nonempty"
29
+
else"empty"
30
+
31
+
3. The scrutinee of a match expression must be an `InfixExpr`. Previously the scrutinee could be followed by a typeascription `: T`, but this is no longer supported. So `x : T match { ... }` now has to be
0 commit comments