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 {
26042604 })
26052605 }
26062606
2607- /** TypeCaseClause ::= ‘case’ InfixType ‘=>’ Type [nl ]
2607+ /** TypeCaseClause ::= ‘case’ InfixType ‘=>’ Type [semi ]
26082608 */
26092609 def typeCaseClause (): CaseDef = atSpan(in.offset) {
26102610 val pat = inSepRegion(InCase ) {
@@ -2613,6 +2613,7 @@ object Parsers {
26132613 }
26142614 CaseDef (pat, EmptyTree , atSpan(accept(ARROW )) {
26152615 val t = typ()
2616+ if in.token == SEMI then in.nextToken()
26162617 newLinesOptWhenFollowedBy(CASE )
26172618 t
26182619 })
Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ CaseClauses ::= CaseClause { CaseClause }
287287CaseClause ::= ‘case’ Pattern [Guard] ‘=>’ Block CaseDef(pat, guard?, block) // block starts at =>
288288ExprCaseClause ::= ‘case’ Pattern [Guard] ‘=>’ Expr
289289TypeCaseClauses ::= TypeCaseClause { TypeCaseClause }
290- TypeCaseClause ::= ‘case’ InfixType ‘=>’ Type [nl ]
290+ TypeCaseClause ::= ‘case’ InfixType ‘=>’ Type [semi ]
291291
292292Pattern ::= Pattern1 { ‘|’ Pattern1 } Alternative(pats)
293293Pattern1 ::= 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 }
279279CaseClause ::= ‘case’ Pattern [Guard] ‘=>’ Block
280280ExprCaseClause ::= ‘case’ Pattern [Guard] ‘=>’ Expr
281281TypeCaseClauses ::= TypeCaseClause { TypeCaseClause }
282- TypeCaseClause ::= ‘case’ InfixType ‘=>’ Type [nl ]
282+ TypeCaseClause ::= ‘case’ InfixType ‘=>’ Type [semi ]
283283
284284Pattern ::= Pattern1 { ‘|’ Pattern1 }
285285Pattern1 ::= 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