Skip to content

Commit 900a7e3

Browse files
committed
add failing tests for inline records in completing patterns
1 parent 9102463 commit 900a7e3

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

analysis/tests/src/CompletionPattern.res

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,13 @@ let s = (true, Some(true), [false])
191191

192192
// switch b { | #one | #three({test: true}, true | ) }
193193
// ^com
194+
195+
type variantWithInlineRecord = One({thing: bool, otherThing: option<bool>})
196+
197+
let r: variantWithInlineRecord = One({thing: true, otherThing: None})
198+
199+
// switch r { | One()}
200+
// ^com
201+
202+
// switch r { | One({})}
203+
// ^com

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,3 +871,26 @@ Completable: Cpattern Value[b]->polyvariantPayload::three($1)
871871
"documentation": null
872872
}]
873873

874+
Complete src/CompletionPattern.res 198:20
875+
posCursor:[198:20] posNoWhite:[198:19] Found expr:[198:3->198:22]
876+
posCursor:[198:20] posNoWhite:[198:19] Found pattern:[198:16->198:21]
877+
Ppat_construct One:[198:16->198:19]
878+
posCursor:[198:20] posNoWhite:[198:19] Found pattern:[198:19->198:21]
879+
Ppat_construct ():[198:19->198:21]
880+
Completable: Cpattern Value[r]->variantPayload::One($0)
881+
[]
882+
883+
Complete src/CompletionPattern.res 201:21
884+
posCursor:[201:21] posNoWhite:[201:20] Found expr:[201:3->201:24]
885+
posCursor:[201:21] posNoWhite:[201:20] Found pattern:[201:16->201:23]
886+
Ppat_construct One:[201:16->201:19]
887+
posCursor:[201:21] posNoWhite:[201:20] Found pattern:[201:20->201:22]
888+
Completable: Cpattern Value[r]->variantPayload::One($0), recordBody
889+
[{
890+
"label": "One",
891+
"kind": 4,
892+
"tags": [],
893+
"detail": "One\n\ntype variantWithInlineRecord =\n | One({thing: bool, otherThing: option<bool>})",
894+
"documentation": null
895+
}]
896+

0 commit comments

Comments
 (0)