Skip to content

Dialyzer Warning in Task.Supervisor #14655

@maennchen

Description

@maennchen

Elixir and Erlang/OTP versions

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

Elixir 1.18.4 (compiled with Erlang/OTP 25)

Operating system

Ubuntu 24.04

Current behavior

defmodule Test do
  @spec run_task() :: Task.t()
  def run_task do
    Task.Supervisor.async(SupervisorName, fn ->
      # Your task implementation here
      :ok
    end)
  end
end

=>

lib/test.ex:2:contract_with_opaque
The @spec for Test.run_task/0 has an opaque
subtype %Task{
  :mfa => {atom(), atom(), byte()},
  :owner => pid(),
  :pid => nil | pid(),
  :ref => Task.ref()
} which is violated by the success typing.

Success typing:
() :: %Task{
  :mfa => {_, _, non_neg_integer()},
  :owner => pid(),
  :pid => atom() | pid() | port() | {atom(), atom()},
  :ref => reference()
}

Expected behavior

No Warning

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