Skip to content

Type printer collision between arity-specific function top and maximal explicit arrow #15829

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]

Elixir 1.21.0-dev (469c844) (compiled with Erlang/OTP 28)

Operating system

any

Current behavior

fun(1) and fun([none()], term()) are distinct types, but both currently print as (none() -> term()).

import Module.Types.Descr

top = fun(1)
arrow = fun([none()], term())

to_quoted_string(top)
#=> "(none() -> term())"

to_quoted_string(arrow)
#=> "(none() -> term())"

equal?(top, arrow)
#=> false

subtype?(arrow, top)
#=> true

subtype?(top, arrow)
#=> false

empty?(opt_difference(top, arrow))
#=> false

Expected behavior

Type printer improved. Alternatively if this is a deliberate choice it should be noted in the code documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions