Skip to content

Commit fec7662

Browse files
zthcristianoc
authored andcommitted
fix cross file
1 parent 35c2aef commit fec7662

File tree

4 files changed

+69
-1
lines changed

4 files changed

+69
-1
lines changed

analysis/src/TypeUtils.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ let rec resolveNestedPatternPath (typ : innerType) ~env ~full ~nested =
397397
| Some completionType -> (
398398
match (finalPatternPath, completionType) with
399399
| ( Completable.NFollowRecordField {fieldName},
400-
(TinlineRecord {env; fields} | Trecord {env; fields}) ) -> (
400+
(TinlineRecord {fields} | Trecord {fields}) ) -> (
401401
match fields |> findTypeOfRecordField ~fieldName with
402402
| None -> None
403403
| Some typ -> Some (TypeExpr typ, env))

analysis/tests/src/CompletionInferValues.res

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,19 @@ let fnWithRecordCallback = (cb: someRecord => unit) => {
131131
// Complete pattern of function parameter
132132
// fnWithRecordCallback(({}) => {()})
133133
// ^com
134+
135+
let fn2 = (~cb: CompletionSupport.Nested.config => unit) => {
136+
let _ = cb
137+
}
138+
139+
// fn2(~cb=({root}) => {root-> })
140+
// ^com
141+
142+
type sameFileRecord = {root: CompletionSupport.Test.t, test: int}
143+
144+
let fn3 = (~cb: sameFileRecord => unit) => {
145+
let _ = cb
146+
}
147+
148+
// fn3(~cb=({root}) => {root-> })
149+
// ^com

analysis/tests/src/CompletionSupport.res

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ module TestComponent = {
2222
React.null
2323
}
2424
}
25+
26+
module Nested = {
27+
type config = {root: ReactDOM.Client.Root.t}
28+
}

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,51 @@ Completable: Cpattern CArgument CArgument Value[fnWithRecordCallback]($0)($0)->r
420420
"documentation": null
421421
}]
422422

423+
Complete src/CompletionInferValues.res 138:30
424+
posCursor:[138:30] posNoWhite:[138:29] Found expr:[138:3->138:33]
425+
Pexp_apply ...[138:3->138:6] (~cb138:8->138:10=...[138:11->138:32])
426+
posCursor:[138:30] posNoWhite:[138:29] Found expr:[138:11->138:32]
427+
posCursor:[138:30] posNoWhite:[138:29] Found expr:[138:24->0:-1]
428+
posCursor:[138:30] posNoWhite:[138:29] Found expr:[138:24->0:-1]
429+
Completable: Cpath Value[root]->
430+
[{
431+
"label": "ReactDOM.Client.Root.unmount",
432+
"kind": 12,
433+
"tags": [],
434+
"detail": "(t, unit) => unit",
435+
"documentation": null
436+
}, {
437+
"label": "ReactDOM.Client.Root.render",
438+
"kind": 12,
439+
"tags": [],
440+
"detail": "(t, React.element) => unit",
441+
"documentation": null
442+
}]
443+
444+
Complete src/CompletionInferValues.res 147:30
445+
posCursor:[147:30] posNoWhite:[147:29] Found expr:[147:3->147:33]
446+
Pexp_apply ...[147:3->147:6] (~cb147:8->147:10=...[147:11->147:32])
447+
posCursor:[147:30] posNoWhite:[147:29] Found expr:[147:11->147:32]
448+
posCursor:[147:30] posNoWhite:[147:29] Found expr:[147:24->0:-1]
449+
posCursor:[147:30] posNoWhite:[147:29] Found expr:[147:24->0:-1]
450+
Completable: Cpath Value[root]->
451+
[{
452+
"label": "CompletionSupport.Test.add",
453+
"kind": 12,
454+
"tags": [],
455+
"detail": "t => int",
456+
"documentation": null
457+
}, {
458+
"label": "CompletionSupport.Test.addSelf",
459+
"kind": 12,
460+
"tags": [],
461+
"detail": "t => t",
462+
"documentation": null
463+
}, {
464+
"label": "CompletionSupport.Test.make",
465+
"kind": 12,
466+
"tags": [],
467+
"detail": "int => t",
468+
"documentation": null
469+
}]
470+

0 commit comments

Comments
 (0)