Skip to content

Commit aa3d235

Browse files
committed
Add guards to typespec translation, closes #13948
1 parent c90bd0f commit aa3d235

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/elixir/lib/kernel/typespec.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ defmodule Kernel.Typespec do
290290
:lists.filter(fun, types)
291291
end
292292

293-
defp translate_type({kind, {:"::", _, [{name, meta, args}, definition]}, pos}, state) do
293+
defp translate_type({kind, {:"::", _, [{name, meta, args}, definition]}, pos}, state)
294+
when is_list(meta) do
294295
caller = :elixir_locals.get_cached_env(pos)
295296
state = clean_local_state(state)
296297

@@ -358,7 +359,7 @@ defmodule Kernel.Typespec do
358359
end
359360

360361
defp translate_spec(kind, {:"::", _, [{name, meta, args}, return]}, guard, caller, state)
361-
when is_atom(name) and name != :"::" do
362+
when is_atom(name) and name != :"::" and is_list(meta) and (is_list(args) or is_atom(args)) do
362363
translate_spec(kind, meta, name, args, return, guard, caller, state)
363364
end
364365

0 commit comments

Comments
 (0)