Skip to content

Commit dd25d02

Browse files
authored
fix(lsp): Fix lsp crash when hovering on function with default arg (#1969)
1 parent 52cc15a commit dd25d02

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

compiler/src/typed/printtyp.re

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -723,17 +723,19 @@ let rec tree_of_typexp = (sch, ty) => {
723723
}
724724

725725
and tree_of_typlist = (sch, tyl) => List.map(tree_of_typexp(sch), tyl)
726+
and get_arg_type = ty => {
727+
switch (ty.desc) {
728+
| TTyConstr(_, [ty], _) => ty
729+
| TTyLink(ty) => get_arg_type(ty)
730+
| _ => failwith("Impossible: optional argument with non-option type")
731+
};
732+
}
726733
and tree_of_argtyplist = (sch, al) =>
727734
List.map(
728735
((l, ty)) => {
729736
let ty =
730737
switch (l) {
731-
| Default(_) =>
732-
switch (ty.desc) {
733-
| TTyConstr(_, [ty], _) => ty
734-
| _ =>
735-
failwith("Impossible: optional argument with non-option type")
736-
}
738+
| Default(_) => get_arg_type(ty)
737739
| _ => ty
738740
};
739741
(qualified_label_name(l), tree_of_typexp(sch, ty));

0 commit comments

Comments
 (0)