Skip to content

Commit b06544f

Browse files
committed
Handle case where spread coming from different module
1 parent 3863f08 commit b06544f

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

jscomp/syntax/src/res_printer.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2969,7 +2969,7 @@ and printExpression ~state (e : Parsetree.expression) cmtTbl =
29692969
match pexp_desc with
29702970
| Pexp_constant (Pconst_string _) ->
29712971
printExpression ~state expr cmtTbl
2972-
| Pexp_ident {txt = Lident txt} -> printIdentLike txt
2972+
| Pexp_ident {txt = expr} -> printLident expr
29732973
| _ -> Doc.nil
29742974
in
29752975
let docWithSpread =

jscomp/syntax/tests/printer/comments/expected/expr.res.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,15 @@ type b = {
295295
b: string,
296296
}
297297

298+
type a = {
299+
// spread from different module
300+
...M.a,
301+
// spread c
302+
...c,
303+
// no spread
304+
b: string
305+
}
306+
298307
let b = {
299308
// exotic
300309
...\"let",
@@ -308,3 +317,10 @@ let b = {
308317
// foo
309318
bar: "foo",
310319
}
320+
321+
let c = {
322+
// from different module
323+
...M.a,
324+
// foo
325+
bar: "foo"
326+
}

jscomp/syntax/tests/printer/comments/expr.res

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,15 @@ type b = {
286286
b: string
287287
}
288288

289+
type a = {
290+
// spread from different module
291+
...M.a,
292+
// spread c
293+
...c,
294+
// no spread
295+
b: string
296+
}
297+
289298
let b = {
290299
// exotic
291300
...\"let",
@@ -299,3 +308,10 @@ let b = {
299308
// foo
300309
bar: "foo"
301310
}
311+
312+
let c = {
313+
// from different module
314+
...M.a,
315+
// foo
316+
bar: "foo"
317+
}

0 commit comments

Comments
 (0)