Skip to content

to_quoted_string prints inverted type on list with negated leaves #15513

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

A list with negated leaf is printed incorrectly possibly leading to invalid/confusing warning messages

Repro:

d = opt_difference(list(term()), non_empty_list(integer()))

subtype?(empty_list(), d)
true

to_quoted_string(d)
"list(term()) and not list(integer())" # wrong, should be `list(term()) and not non_empty_list(integer())`

Expected behavior

Correct string representation returned

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions