Skip to content

Commit e78091a

Browse files
cknittzth
authored andcommitted
Add broken test for record destructuring
1 parent 4ca71e8 commit e78091a

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

analysis/tests/src/Destructuring.res

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
type x = {name: string, age: int}
2+
3+
let x = {name: "123", age: 12}
4+
5+
let {name, } = x
6+
// ^com
7+
8+
// let {} = x
9+
// ^com
10+
11+
let f = (x: x) => {
12+
let {name, } = x
13+
// ^com
14+
name
15+
}
16+
17+
let f2 = (x: x) => {
18+
// let {} = x
19+
// ^com
20+
ignore(x)
21+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Complete src/Destructuring.res 4:11
2+
posCursor:[4:11] posNoWhite:[4:9] Found pattern:[4:4->4:12]
3+
Completable: Cpattern Value[x]->recordBody
4+
[{
5+
"label": "age",
6+
"kind": 5,
7+
"tags": [],
8+
"detail": "age: int\n\nx",
9+
"documentation": null
10+
}]
11+
12+
Complete src/Destructuring.res 7:8
13+
posCursor:[7:8] posNoWhite:[7:7] Found pattern:[7:7->7:9]
14+
Completable: Cpattern Value[x]->recordBody
15+
[{
16+
"label": "name",
17+
"kind": 5,
18+
"tags": [],
19+
"detail": "name: string\n\nx",
20+
"documentation": null
21+
}, {
22+
"label": "age",
23+
"kind": 5,
24+
"tags": [],
25+
"detail": "age: int\n\nx",
26+
"documentation": null
27+
}]
28+
29+
Complete src/Destructuring.res 11:13
30+
posCursor:[11:13] posNoWhite:[11:11] Found expr:[10:8->14:1]
31+
posCursor:[11:13] posNoWhite:[11:11] Found expr:[11:2->13:6]
32+
posCursor:[11:13] posNoWhite:[11:11] Found pattern:[11:6->11:14]
33+
[]
34+
35+
Complete src/Destructuring.res 17:10
36+
posCursor:[17:10] posNoWhite:[17:9] Found expr:[16:9->20:1]
37+
posCursor:[17:10] posNoWhite:[17:9] Found expr:[17:5->19:11]
38+
posCursor:[17:10] posNoWhite:[17:9] Found pattern:[17:9->17:11]
39+
[]
40+

0 commit comments

Comments
 (0)