Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Fix problem with string in braces introduced in #494 #509

Merged
merged 1 commit into from
May 29, 2022
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
3 changes: 2 additions & 1 deletion src/res_core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2772,7 +2772,8 @@ and parseBracedOrRecordExpr p =
Parser.expect Rbrace p;
expr
| _ ->
let constant = Ast_helper.Exp.constant ~loc:field.loc (Parsetree.Pconst_string(s, Some("js"))) in
let tag = if p.mode = ParseForTypeChecker then Some "js" else None in
let constant = Ast_helper.Exp.constant ~loc:field.loc (Parsetree.Pconst_string(s, tag)) in
let a = parsePrimaryExpr ~operand:constant p in
let e = parseBinaryExpr ~a p 1 in
let e = parseTernaryExpr e p in
Expand Down
4 changes: 4 additions & 0 deletions tests/printer/expr/expected/switch.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ let x =
switch x {
| Universe => ()
}

switch count {
| 1 => "one"
}
4 changes: 4 additions & 0 deletions tests/printer/expr/switch.res
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ let rec updateSum = (node, ~delta) =>
let x = @attr switch x {
| Universe => ()
}

switch count {
| 1 => { "one" }
}