Skip to content

Commit 54ebacd

Browse files
committed
add failing test for optional record fields
1 parent 67f620e commit 54ebacd

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

analysis/tests/src/CompletionExpressions.res

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,15 @@ let fnTakingOtherRecord = (r: otherRecord) => {
9696

9797
// let _ = fnTakingOtherRecord({otherField: })
9898
// ^com
99+
100+
type recordWithOptionalField = {
101+
someField: int,
102+
someOptField?: string,
103+
}
104+
105+
let fnTakingRecordWithOptionalField = (r: recordWithOptionalField) => {
106+
ignore(r)
107+
}
108+
109+
// let _ = fnTakingRecordWithOptionalField({someOptField: })
110+
// ^com

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,3 +427,23 @@ Completable: Cexpression CArgument Value[fnTakingOtherRecord]($0)->recordField(o
427427
"insertTextFormat": 2
428428
}]
429429

430+
Complete src/CompletionExpressions.res 108:57
431+
posCursor:[108:57] posNoWhite:[108:56] Found expr:[108:11->108:60]
432+
Pexp_apply ...[108:11->108:42] (...[108:43->108:60])
433+
Completable: Cexpression CArgument Value[fnTakingRecordWithOptionalField]($0)->recordField(someOptField)
434+
[{
435+
"label": "None",
436+
"kind": 4,
437+
"tags": [],
438+
"detail": "string",
439+
"documentation": null
440+
}, {
441+
"label": "Some(_)",
442+
"kind": 4,
443+
"tags": [],
444+
"detail": "string",
445+
"documentation": null,
446+
"insertText": "Some(${1:_})",
447+
"insertTextFormat": 2
448+
}]
449+

0 commit comments

Comments
 (0)