Skip to content

Fix Code.Typespec.spec_to_quoted/2 incomplete variable type collection - #15700

Merged
josevalim merged 1 commit into
elixir-lang:mainfrom
AlexGx:ag-spec_nested_type_vars-fix
Jul 29, 2026
Merged

Fix Code.Typespec.spec_to_quoted/2 incomplete variable type collection#15700
josevalim merged 1 commit into
elixir-lang:mainfrom
AlexGx:ag-spec_nested_type_vars-fix

Conversation

@AlexGx

@AlexGx AlexGx commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Code.Typespec.spec_to_quoted/2 skips type vars nested in annotated spec arguments

Erlang stdlib array

iex> h :array.default/1
...
  @spec default(array :: array(type)) :: value :: type

Expected

@spec default(array :: array(type)) :: value :: type when type: var

Elixir module

defmodule Repro do
  @spec foo(arg1 :: [t], arg2 :: [t]) :: atom() when t: var
  def foo(_, _), do: :ok
end
iex>  h Repro.foo/2
...    
    @spec foo(arg1 :: [t], arg2 :: [t]) :: atom()

Expected

@spec foo(arg1 :: [t], arg2 :: [t]) :: atom() when t: var`

when TYPE_VAR: var part is missing because :ann_type node is ignored

@josevalim
josevalim merged commit a0b17a3 into elixir-lang:main Jul 29, 2026
15 checks passed
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants