Skip to content

Commit

Permalink
Prevent looping in scrape-aliases (fixes ocaml/ocaml-lsp#1192) (#1686)
Browse files Browse the repository at this point in the history
from voodoos/fix-scrape-aliases
  • Loading branch information
voodoos authored Sep 26, 2023
2 parents 9b072a5 + 4567b30 commit 1859d9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ unreleased
+ merlin binary
- Fix issue with let operators and tuples (#1684, fixes #1683, fixes
ocaml/ocaml-lsp#1182)
- Fix an issue causing Merlin locate queries to hang (#1686,
fixes ocaml/ocaml-lsp#1192)

merlin 4.11
===========
Expand Down
5 changes: 4 additions & 1 deletion src/analysis/locate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,11 @@ let scrape_alias ~env ~fallback_uid ~namespace path =
in
let rec non_alias_declaration_uid ~fallback_uid path =
match find_type_and_uid ~env ~namespace path with
| (Mty_alias path | Mty_ident path), fallback_uid ->
| Mty_alias path, fallback_uid ->
non_alias_declaration_uid ~fallback_uid path
| Mty_ident alias_path, fallback_uid when not (Path.same path alias_path) ->
(* This case is necessary to traverse module type aliases *)
non_alias_declaration_uid ~fallback_uid alias_path
| _, md_uid -> md_uid
| exception Not_found -> fallback_uid
in
Expand Down

0 comments on commit 1859d9e

Please sign in to comment.