Skip to content

Fix list operators type inference test on Elixir 1.20.3+ - #347

Merged
lukaszsamson merged 1 commit into
masterfrom
fix-list-operators-test-elixir-1-20-3
Oct 18, 2026
Merged

lukaszsamson merged 1 commit into
masterfrom
fix-list-operators-test-elixir-1-20-3

Conversation

@lukaszsamson

Copy link
Copy Markdown
Collaborator

CI on master fails on every Elixir 1.20.x job (it has since 1.20.3 was released) with one test:

1) test type_of list operators (ElixirSense.Core.TypeInferenceTest)
   test/elixir_sense/core/type_inference_test.exs:447
   left:  {:nonempty_list, nil}
   right: {:call, {:atom, :erlang}, :++, [nonempty_list: nil, nonempty_list: nil]}

Elixir 1.20.3 (elixir-lang/elixir@f894bc4, "Provide proper signature for ++") added a remote_apply(:erlang, :++, ...) rule. It types the result from the arguments, so [a] ++ [b] is now a proper non-empty list instead of the improper-tail static signature. That result is more precise and correct. This PR gates the native expectation on >= 1.20.3 and leaves the older expectation for 1.19 – 1.20.2.

Verified locally: type_inference_test.exs passes on 1.20.4/OTP 29 and 1.19.4/OTP 28.

Elixir 1.20.3 (elixir-lang/elixir@f894bc4) infers the result of :erlang.++
from its arguments instead of the static signature, so native typing of
`[a] ++ [b]` is now a proper non-empty list rather than the call thunk
fallback. Gate the native expectation on the Elixir version.
@lukaszsamson
lukaszsamson merged commit 55bb1de into master Oct 18, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant