Skip to content

non_empty_list/2 tail absorption unexpected behavior #15641

Description

@lukaszsamson

Existing issue

  • I have searched existing issues and could not find a duplicate.

Elixir and Erlang/OTP versions

Erlang/OTP 28 [erts-16.4.0.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Interactive Elixir (1.21.0-dev)

Operating system

any

Current behavior

I understand that type widening and tail absorption is deliberate but it leads to surprising results. Here I construct a type [none(), (...), | term()] which is not inhabited by any value. none() gets overapproximated to term()

Repro:

t = non_empty_list(none(), term())
empty?(t) # false, I'd expect true
to_quoted_string(t) # "non_empty_list(term(), term())"
equal?(non_empty_list(none(), term()), non_empty_list(term(), term())) # true

Expected behavior

I don't know. Either accepted overapproximation or improved precision

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions