Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1557,10 +1557,10 @@ object Parsers {
else p
}

/** Pattern2 ::= [varid `@'] InfixPattern
/** Pattern2 ::= [id `@'] InfixPattern
*/
val pattern2 = () => infixPattern() match {
case p @ Ident(name) if isVarPattern(p) && in.token == AT =>
case p @ Ident(name) if in.token == AT =>
val offset = in.skipToken()

// compatibility for Scala2 `x @ _*` syntax
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/internals/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ CaseClause ::= ‘case’ (Pattern [Guard] ‘=>’ Block | INT)
Pattern ::= Pattern1 { ‘|’ Pattern1 } Alternative(pats)
Pattern1 ::= PatVar ‘:’ RefinedType Bind(name, Typed(Ident(wildcard), tpe))
| Pattern2
Pattern2 ::= [varid ‘@’] InfixPattern Bind(name, pat)
Pattern2 ::= [id ‘@’] InfixPattern Bind(name, pat)
InfixPattern ::= SimplePattern { id [nl] SimplePattern } InfixOp(pat, op, pat)
SimplePattern ::= PatVar Ident(wildcard)
| Literal Bind(name, Ident(wildcard))
Expand Down
5 changes: 5 additions & 0 deletions tests/pos/i3412.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Test {
val A @ List() = List()
val B @ List(), C: List[Int] = List()
val D @ List(), E @ List() = List()
}