Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Scala: do not parse parenthesized expressions as unary tuples #526

Merged
merged 1 commit into from Jun 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions lang_scala/parsing/Parser_scala_recursive_descent.ml
Expand Up @@ -1806,8 +1806,12 @@ and simpleExpr in_ : expr =
* expressions when part of a short lambda (arrow).
*)
| LPAREN _ ->
let xs = makeParens (commaSeparated expr) in_ in
Tuple xs
let (_,xs,_) as tuple = makeParens (commaSeparated expr) in_ in
begin
match xs with
| [x] -> x
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need a ParenExpr at some point here :)

| _ -> Tuple tuple
end
| LBRACE _ ->
canApply := false;
let x = blockExpr in_ in
Expand Down