Skip to content

Commit ec6ec7a

Browse files
zthcristianoc
authored andcommitted
add test
1 parent ef45cde commit ec6ec7a

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

analysis/tests/src/CompletionInferValues.res

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ type otherNestedRecord = {
120120
// let x: array<otherNestedRecord>; switch x { | [inner] => inner.s }
121121
// ^com
122122

123+
// Infer top level return
124+
// let x = 123; switch x { | 123 => () | v => v->toSt }
125+
// ^com
126+
123127
let fnWithRecordCallback = (cb: someRecord => unit) => {
124128
let _ = cb
125129
}

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

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ Completable: Cpath Value[x].""
222222

223223
Complete src/CompletionInferValues.res 79:78
224224
posCursor:[79:78] posNoWhite:[79:77] Found expr:[79:70->79:78]
225-
Pexp_field [79:70->79:77] _:[122:0->79:78]
225+
Pexp_field [79:70->79:77] _:[126:0->79:78]
226226
Completable: Cpath Value[srecord].""
227227
[{
228228
"label": "name",
@@ -240,7 +240,7 @@ Completable: Cpath Value[srecord].""
240240

241241
Complete src/CompletionInferValues.res 83:86
242242
posCursor:[83:86] posNoWhite:[83:85] Found expr:[83:78->83:86]
243-
Pexp_field [83:78->83:85] _:[122:0->83:86]
243+
Pexp_field [83:78->83:85] _:[126:0->83:86]
244244
Completable: Cpath Value[aliased].""
245245
[{
246246
"label": "someRecord",
@@ -252,7 +252,7 @@ Completable: Cpath Value[aliased].""
252252

253253
Complete src/CompletionInferValues.res 87:103
254254
posCursor:[87:103] posNoWhite:[87:102] Found expr:[87:92->87:103]
255-
Pexp_field [87:92->87:102] _:[122:0->87:103]
255+
Pexp_field [87:92->87:102] _:[126:0->87:103]
256256
Completable: Cpath Value[someRecord].""
257257
[{
258258
"label": "name",
@@ -388,12 +388,23 @@ Completable: Cpath Value[inner].s
388388
"documentation": null
389389
}]
390390

391-
Complete src/CompletionInferValues.res 127:26
392-
posCursor:[127:26] posNoWhite:[127:25] Found expr:[127:3->127:37]
393-
Pexp_apply ...[127:3->127:23] (...[127:24->127:36])
394-
posCursor:[127:26] posNoWhite:[127:25] Found expr:[127:24->127:36]
395-
posCursor:[127:26] posNoWhite:[127:25] Found pattern:[127:25->127:27]
396-
posCursor:[127:26] posNoWhite:[127:25] Found pattern:[127:25->127:27]
391+
Complete src/CompletionInferValues.res 123:53
392+
posCursor:[123:53] posNoWhite:[123:52] Found expr:[123:46->123:53]
393+
Completable: Cpath Value[v]->toSt
394+
[{
395+
"label": "Belt.Int.toString",
396+
"kind": 12,
397+
"tags": [],
398+
"detail": "int => string",
399+
"documentation": {"kind": "markdown", "value": "\n Converts a given `int` to a `string`. Uses the JavaScript `String` constructor under the hood.\n\n ```res example\n Js.log(Belt.Int.toString(1) === \"1\") /* true */\n ```\n"}
400+
}]
401+
402+
Complete src/CompletionInferValues.res 131:26
403+
posCursor:[131:26] posNoWhite:[131:25] Found expr:[131:3->131:37]
404+
Pexp_apply ...[131:3->131:23] (...[131:24->131:36])
405+
posCursor:[131:26] posNoWhite:[131:25] Found expr:[131:24->131:36]
406+
posCursor:[131:26] posNoWhite:[131:25] Found pattern:[131:25->131:27]
407+
posCursor:[131:26] posNoWhite:[131:25] Found pattern:[131:25->131:27]
397408
Completable: Cpattern CArgument CArgument Value[fnWithRecordCallback]($0)($0)->recordBody
398409
[{
399410
"label": "name",

0 commit comments

Comments
 (0)