Skip to content

Commit 8515796

Browse files
committed
Support type instantiation in the presence of aliasing.
1 parent 9e43be8 commit 8515796

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,11 @@ let rec extractRecordType ~env ~package (t : Types.type_expr) =
10441044
{field with typ = fieldTyp})
10451045
in
10461046
Some (env, fields, typ)
1047-
| Some (env, {item = {decl = {type_manifest = Some t1}}}) ->
1047+
| Some
1048+
( env,
1049+
{item = {decl = {type_manifest = Some t1; type_params = typeParams}}}
1050+
) ->
1051+
let t1 = t1 |> instantiateType ~typeParams ~typeArgs in
10481052
extractRecordType ~env ~package t1
10491053
| _ -> None)
10501054
| _ -> None

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,23 @@ Complete src/Hover.res 180:16
138138
posCursor:[180:16] posNoWhite:[180:15] Found expr:[180:5->180:16]
139139
Pexp_field [180:5->180:15] _:[185:0->180:16]
140140
Completable: Cpath Value[y1].content.""
141-
[]
141+
[{
142+
"label": "age",
143+
"kind": 5,
144+
"tags": [],
145+
"detail": "age: int\n\ntype bar = {age: int}",
146+
"documentation": null
147+
}]
142148

143149
Complete src/Hover.res 183:16
144150
posCursor:[183:16] posNoWhite:[183:15] Found expr:[183:5->183:16]
145151
Pexp_field [183:5->183:15] _:[185:0->183:16]
146152
Completable: Cpath Value[y2].content.""
147-
[]
153+
[{
154+
"label": "age",
155+
"kind": 5,
156+
"tags": [],
157+
"detail": "age: int\n\ntype bar = {age: int}",
158+
"documentation": null
159+
}]
148160

0 commit comments

Comments
 (0)