Skip to content

generated meta is not respected by new type system #13727

@hissssst

Description

@hissssst

Elixir and Erlang/OTP versions

Erlang/OTP 27 [erts-15.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Elixir 1.17.1 (compiled with Erlang/OTP 27)

Operating system

linux

Current behavior

defmodule Xxx do
  defmacro f(x) do
    quote generated: true do
      unquote(x) < 2
    end
  end

  def g do
    f(:x)
  end
end
Compiling 1 file (.ex)
    warning: comparison between incompatible types found:

        :x < 2

    While Elixir can compare across all types, you are comparing across types which are always distinct, and the result is either always true or always false

    typing violation found at:
    │
  9 │     f(:x)
    │     ~~~~~
    │
    └─ lib/xxx.ex:9: Xxx.g/0

Expected behavior

No warning produced

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