Skip to content

Commit

Permalink
fix(lsp): Fix lsp crash when hovering on function with default arg (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
spotandjake authored Jan 16, 2024
1 parent 52cc15a commit dd25d02
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions compiler/src/typed/printtyp.re
Original file line number Diff line number Diff line change
Expand Up @@ -723,17 +723,19 @@ let rec tree_of_typexp = (sch, ty) => {
}

and tree_of_typlist = (sch, tyl) => List.map(tree_of_typexp(sch), tyl)
and get_arg_type = ty => {
switch (ty.desc) {
| TTyConstr(_, [ty], _) => ty
| TTyLink(ty) => get_arg_type(ty)
| _ => failwith("Impossible: optional argument with non-option type")
};
}
and tree_of_argtyplist = (sch, al) =>
List.map(
((l, ty)) => {
let ty =
switch (l) {
| Default(_) =>
switch (ty.desc) {
| TTyConstr(_, [ty], _) => ty
| _ =>
failwith("Impossible: optional argument with non-option type")
}
| Default(_) => get_arg_type(ty)
| _ => ty
};
(qualified_label_name(l), tree_of_typexp(sch, ty));
Expand Down

0 comments on commit dd25d02

Please sign in to comment.