Skip to content

Commit 58317a5

Browse files
committed
do not change __deriving__ contrract
1 parent 496c34c commit 58317a5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

apps/language_server/lib/language_server/providers/code_lens/type_spec/contract_translator.ex

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,16 @@ defmodule ElixirLS.LanguageServer.Providers.CodeLens.TypeSpec.ContractTranslator
144144
cond do
145145
Code.ensure_loaded?(mod) and function_exported?(mod, :__protocol__, 1) ->
146146
# defprotocol
147-
case ast do
148-
{:"::", [], [{:foo, [], [_ | rest_args]}, res]} ->
147+
case {ast, fun} do
148+
{ast, :__deriving__} ->
149+
# do not change __deriving__ macrocallback
150+
ast
151+
{{:"::", [], [{:foo, [], [_ | rest_args]}, res]}, _} ->
149152
# ordinary defs in defprotocol do not have when and have at least 1 arg
150153
# first arg in defprotocol defs is always of type t
151154
{:"::", [], [{:foo, [], [{:t, [], []} | rest_args]}, res]}
152155

153-
{:"::", [], [{:foo, [], []}, _]} ->
156+
{{:"::", [], [{:foo, [], []}, _]}, _} ->
154157
# def with default arg
155158
ast
156159
end

0 commit comments

Comments
 (0)