From d3516430037f3d30533779af8e02408774f3e885 Mon Sep 17 00:00:00 2001 From: Hakan Nilsson Date: Mon, 8 Jan 2024 10:31:37 +0100 Subject: [PATCH] Fix invalid crossref warning for Mod:module_info() (#1471) --- .../src/diagnostics_xref_pseudo.erl | 2 ++ apps/els_lsp/src/els_crossref_diagnostics.erl | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/els_lsp/priv/code_navigation/src/diagnostics_xref_pseudo.erl b/apps/els_lsp/priv/code_navigation/src/diagnostics_xref_pseudo.erl index 44b102db0..841fce05c 100644 --- a/apps/els_lsp/priv/code_navigation/src/diagnostics_xref_pseudo.erl +++ b/apps/els_lsp/priv/code_navigation/src/diagnostics_xref_pseudo.erl @@ -33,4 +33,6 @@ main() -> % At lease one failure so we know the diagnostic is running unknown_module:nonexistent(), + Mod:module_info(), + Mod:module_info(module), ok. diff --git a/apps/els_lsp/src/els_crossref_diagnostics.erl b/apps/els_lsp/src/els_crossref_diagnostics.erl index c89abbc79..f37a1210e 100644 --- a/apps/els_lsp/src/els_crossref_diagnostics.erl +++ b/apps/els_lsp/src/els_crossref_diagnostics.erl @@ -95,23 +95,23 @@ has_definition( has_definition( #{ kind := application, - id := {Module, module_info, Arity} + data := #{mod_is_variable := true} }, _ -) when Arity =:= 0; Arity =:= 1 -> - {ok, []} =/= els_dt_document_index:lookup(Module); +) -> + true; has_definition( #{ kind := application, - id := {record_info, 2} + id := {Module, module_info, Arity} }, _ -) -> - true; +) when Arity =:= 0; Arity =:= 1 -> + {ok, []} =/= els_dt_document_index:lookup(Module); has_definition( #{ kind := application, - id := {behaviour_info, 1} + id := {record_info, 2} }, _ ) -> @@ -119,7 +119,7 @@ has_definition( has_definition( #{ kind := application, - data := #{mod_is_variable := true} + id := {behaviour_info, 1} }, _ ) ->