Skip to content

Commit

Permalink
Fix syntax.md typo
Browse files Browse the repository at this point in the history
Also, test infix operations taking [...] as a right operand.
  • Loading branch information
odersky committed Nov 26, 2024
1 parent 89e80b9 commit 3830475
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
3 changes: 1 addition & 2 deletions docs/_docs/internals/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ SimpleExpr ::= SimpleRef
| ‘new’ ConstrApp {‘with’ ConstrApp} [TemplateBody] New(constr | templ)
| ‘new’ TemplateBody
| ‘(’ ExprsInParens ‘)’ Parens(exprs)
| ‘[’ ExprInBrackets ‘)’ SeqLiteral(exprs, TypeTree())
| ‘[’ ExprInParens {‘,’ ExprInParens} ‘]’ SeqLiteral(exprs, TypeTree())
| SimpleExpr ‘.’ id Select(expr, id)
| SimpleExpr ‘.’ MatchClause
| SimpleExpr TypeArgs TypeApply(expr, args)
Expand All @@ -300,7 +300,6 @@ TypeSplice ::= spliceId
| ‘$’ ‘{’ Pattern ‘}’ -- when inside quoted type pattern -- deprecated syntax
ExprsInParens ::= ExprInParens {‘,’ ExprInParens}
| NamedExprInParens {‘,’ NamedExprInParens}
ExprsInBrackets ::= ExprInParens {‘,’ ExprInParens}
ExprInParens ::= PostfixExpr ‘:’ Type -- normal Expr allows only RefinedType here
| Expr
NamedExprInParens ::= id '=' ExprInParens
Expand Down
23 changes: 23 additions & 0 deletions tests/run/seqlists.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
last was evaluated
last was evaluated
last was evaluated
Seq List(1, 2, 3, 4)
Vector Vector(1, 2, 3, 4)
BitSet(1, 2, 4)
last was evaluated
Task with elems List(1, 2, 3, 4)
Vector()
List(hello, world)
List(hello, world)
List()
List(1, 2, 3)
List()
Map(1 -> one, 2 -> two)
List(List(1), List(2, 3), List())
List(List(1), List(2, 3), List())
Vector(Vector(1), Vector(2, 3), Vector())
ArrayBuffer(Set(hello, world), Set(), Set(!))
Set(BitSet(1), BitSet(2, 3), BitSet())
Map(1 -> BitSet(1), 2 -> BitSet(1, 2), 0 -> BitSet())
HashMap(0 -> List(), 1 -> List(BitSet(1), BitSet(2, 3)), 2 -> List(BitSet()))
Map(BitSet(1) -> List(1), BitSet(0, 2) -> List(1, 2), BitSet(0) -> List())
1 change: 1 addition & 0 deletions tests/run/seqlits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ object SeqLits:
val _: Seq[Seq[Int]] = ss2
val vs: Vector[Vector[Int]] = [[1], [2, 3], []]
val ab: ArrayBuffer[Set[String]] = [["hello", "world"], []]
ab += ["!"]
val sbs: Set[BitSet] = [[1], [2, 3], []]
val mbs: Map[Int, BitSet] = [1 -> [1], 2 -> [1, 2], 0 -> []]
val hbs: HashMap[Int, Seq[BitSet]] = [1 -> [[1], [2, 3]], 2 -> [[]], 0 -> []]
Expand Down

0 comments on commit 3830475

Please sign in to comment.