File tree Expand file tree Collapse file tree 4 files changed +7
-3
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 4 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2604,7 +2604,7 @@ object Parsers {
2604
2604
})
2605
2605
}
2606
2606
2607
- /** TypeCaseClause ::= ‘case’ InfixType ‘=>’ Type [nl ]
2607
+ /** TypeCaseClause ::= ‘case’ InfixType ‘=>’ Type [semi ]
2608
2608
*/
2609
2609
def typeCaseClause (): CaseDef = atSpan(in.offset) {
2610
2610
val pat = inSepRegion(InCase ) {
@@ -2613,6 +2613,7 @@ object Parsers {
2613
2613
}
2614
2614
CaseDef (pat, EmptyTree , atSpan(accept(ARROW )) {
2615
2615
val t = typ()
2616
+ if in.token == SEMI then in.nextToken()
2616
2617
newLinesOptWhenFollowedBy(CASE )
2617
2618
t
2618
2619
})
Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ CaseClauses ::= CaseClause { CaseClause }
287
287
CaseClause ::= ‘case’ Pattern [Guard] ‘=>’ Block CaseDef(pat, guard?, block) // block starts at =>
288
288
ExprCaseClause ::= ‘case’ Pattern [Guard] ‘=>’ Expr
289
289
TypeCaseClauses ::= TypeCaseClause { TypeCaseClause }
290
- TypeCaseClause ::= ‘case’ InfixType ‘=>’ Type [nl ]
290
+ TypeCaseClause ::= ‘case’ InfixType ‘=>’ Type [semi ]
291
291
292
292
Pattern ::= Pattern1 { ‘|’ Pattern1 } Alternative(pats)
293
293
Pattern1 ::= Pattern2 [‘:’ RefinedType] Bind(name, Typed(Ident(wildcard), tpe))
Original file line number Diff line number Diff line change @@ -279,7 +279,7 @@ CaseClauses ::= CaseClause { CaseClause }
279
279
CaseClause ::= ‘case’ Pattern [Guard] ‘=>’ Block
280
280
ExprCaseClause ::= ‘case’ Pattern [Guard] ‘=>’ Expr
281
281
TypeCaseClauses ::= TypeCaseClause { TypeCaseClause }
282
- TypeCaseClause ::= ‘case’ InfixType ‘=>’ Type [nl ]
282
+ TypeCaseClause ::= ‘case’ InfixType ‘=>’ Type [semi ]
283
283
284
284
Pattern ::= Pattern1 { ‘|’ Pattern1 }
285
285
Pattern1 ::= Pattern2 [‘:’ RefinedType]
Original file line number Diff line number Diff line change
1
+ def Choice = (_ : Any ) match { case Int => Long ; case Long => Int } // ok
2
+
3
+ type Choice [A ] = A match { case Int => Long ; case Long => Int } // error
You can’t perform that action at this time.
0 commit comments