From a5f79dab3793e2cf58a53d9013c8d6597a6a19b1 Mon Sep 17 00:00:00 2001 From: Steve Cohen Date: Thu, 1 Dec 2022 22:05:57 -0800 Subject: [PATCH] Fixed type spec The AST type is very complicated, and dialyzer was telling us I got it wrong. --- .../lib/language_server/experimental/code_mod/ast.ex | 3 ++- .../experimental/code_mod/replace_with_underscore.ex | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/language_server/lib/language_server/experimental/code_mod/ast.ex b/apps/language_server/lib/language_server/experimental/code_mod/ast.ex index 0fd0df006..b5172d301 100644 --- a/apps/language_server/lib/language_server/experimental/code_mod/ast.ex +++ b/apps/language_server/lib/language_server/experimental/code_mod/ast.ex @@ -1,6 +1,7 @@ defmodule ElixirLS.LanguageServer.Experimental.CodeMod.Ast do alias ElixirLS.LanguageServer.Experimental.SourceFile - @opaque t :: tuple() + + @type t :: any() def from(%SourceFile{} = source_file) do source_file diff --git a/apps/language_server/lib/language_server/experimental/code_mod/replace_with_underscore.ex b/apps/language_server/lib/language_server/experimental/code_mod/replace_with_underscore.ex index fd32abc77..ba44fc387 100644 --- a/apps/language_server/lib/language_server/experimental/code_mod/replace_with_underscore.ex +++ b/apps/language_server/lib/language_server/experimental/code_mod/replace_with_underscore.ex @@ -3,7 +3,7 @@ defmodule ElixirLS.LanguageServer.Experimental.CodeMod.ReplaceWithUnderscore do alias ElixirLS.LanguageServer.Experimental.CodeMod.Ast alias ElixirLS.LanguageServer.Experimental.CodeMod.Diff - @spec text_edits(String.t(), Ast.t(), String.t() | atom) :: {:ok, [TextEdit.t()]} + @spec text_edits(String.t(), Ast.t(), String.t() | atom) :: {:ok, [TextEdit.t()]} | :error def text_edits(original_text, ast, variable_name) do variable_name = ensure_atom(variable_name)