Skip to content

Missing line numbers for litterals cause dilayzer to ignore issues (OTP 24) #11107

@lud

Description

@lud
Erlang/OTP 24 [erts-12.0] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit]

Elixir 1.12.1 (compiled with Erlang/OTP 24)

Full description and possible diagnostic were tracked in this elixir forum topic : https://elixirforum.com/t/elixir-ls-not-showing-warnings/40741/13

Probably related to erlang/otp#4890

This code contains an obvious type error although dialyzer does not pick it up:

defmodule MyApp do
  def hello do
    default(1234) # <------- not a binary
  end

  @spec default(binary) :: binary
  def default(bin) when is_binary(bin) do
    "test #{bin}"
  end
end

It looks like some literals in the elixir AST are missing line numbers (or other debug info) when translated to erl AST and it gets in the way of dialyzer. My knowledge of the compiler is very limited so can't add much to that.

Also ping @michallepicki .

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