File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -1137,7 +1137,11 @@ object Parsers {
11371137 lookahead.skipParens()
11381138 isArrowIndent()
11391139 else if lookahead.token == CASE && in.featureEnabled(Feature .relaxedLambdaSyntax) then
1140- Some (() => singleCaseMatch())
1140+ Some : () =>
1141+ inSepRegion(SingleLineLambda (_)):
1142+ singleCaseMatch()
1143+ .tap: _ =>
1144+ accept(ENDlambda )
11411145 else
11421146 None
11431147 isParamsAndArrow()
Original file line number Diff line number Diff line change 1+ import scala .language .experimental .relaxedLambdaSyntax
2+
3+ @ main def Test =
4+ val list = List (1 , 2 , 3 )
5+
6+ val three = list
7+ .collect: case x =>
8+ (x, x + 1 ) // error not a member of tuple
9+ .toMap
10+
11+ val huh = list
12+ .collect: x => case y => (y, y + 1 ) // error expecting case at x
Original file line number Diff line number Diff line change 1+ import scala .language .experimental .relaxedLambdaSyntax
2+
3+ @ main def Test =
4+ val list = List (1 , 2 , 3 )
5+
6+ val two = list
7+ .collect: x => (x, x + 1 )
8+ .toMap
9+
10+ val one = list
11+ .collect: case x => (x, x + 1 )
12+ .toMap
13+
14+ // val huh = list
15+ // .collect: x => case y => (y, y + 1) correctly errors expecting case at x
You can’t perform that action at this time.
0 commit comments