Skip to content

Commit 74b65dd

Browse files
committed
add failing test demonstrating issue with parser
1 parent 64898b5 commit 74b65dd

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

analysis/tests/src/CompletionFunctionArguments.res

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,7 @@ let someFnTakingVariant = (
5353

5454
// let _ = someFnTakingVariant(~configOpt2=O)
5555
// ^com
56+
57+
// This below demonstrates an issue when what you're completing is the _last_ labelled argument, and there's a unit application after it. The parser wrongly merges the unit argument as the expression of the labelled argument assignment, where is should really let the trailing unit argument be, and set a %rescript.exprhole as the expression of the assignment, just like it normally does.
58+
// let _ = someFn(~isOff=, ())
59+
// ^com

analysis/tests/src/expected/CompletionFunctionArguments.res.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,16 @@ Completable: Value[someFnTakingVariant](~configOpt2=O)
140140
"documentation": null
141141
}]
142142

143+
Complete src/CompletionFunctionArguments.res 57:25
144+
posCursor:[57:25] posNoWhite:[57:24] Found expr:[57:11->57:30]
145+
Pexp_apply ...[57:11->57:17] (~isOff57:19->57:24=...[57:27->57:29])
146+
Completable: CnamedArg(Value[someFn], "", [isOff])
147+
Found type for function (~isOn: bool, ~isOff: bool=?, unit) => string
148+
[{
149+
"label": "isOn",
150+
"kind": 4,
151+
"tags": [],
152+
"detail": "bool",
153+
"documentation": null
154+
}]
155+

0 commit comments

Comments
 (0)