Skip to content

FunctionClauseError in Dialyxir.WarningHelpers.ordinal/1 with opaque MapSet type #594

Description

@mbaertschi

Description

When running Dialyzer via dialyxir, an unknown error occurs when a MapSet is passed as a function argument and dialyxir tries to format the warning.

Error

Unknown error occurred: %FunctionClauseError{module: Dialyxir.WarningHelpers, function: :ordinal, arity: 1, kind: nil, args: nil, clauses: nil}

Legacy Warning

lib/aadb/addresses/source/types/source_data.ex:147:68: The call 'Elixir.Aadb.Addresses.Source.Types.SourceData':build_properties('write',#{'__struct__':='Elixir.MapSet', 'map':='Elixir.MapSet':internal(_)}) contains an opaque term as 2nd argument when terms of different types are expected in these positions
________________________________________________________________________________
lib/aadb/addresses/source/types/source_data.ex:164:27:call_without_opaque
Function call without opaqueness type mismatch.

Call does not have expected term of type %MapSet{:map => MapSet.internal(_)} (with opaque subterms) in the 1st position.

MapSet.member?(
  _required :: %MapSet{
    :map =>
      {:set, non_neg_integer(), non_neg_integer(), pos_integer(), non_neg_integer(),
       non_neg_integer(), non_neg_integer(), tuple(), tuple()}
      | %{_ => []}
  },
  _name :: any()
)

Expected Behaviour

Dialyxir should format the call_without_opaque warning with the opaque MapSet type without crashing.

Actual Behaviour

Dialyxir.WarningHelpers.ordinal/1 raises a FunctionClauseError, suggesting it receives an unexpected argument (likely the ordinal position of the opaque term — 2 in the legacy warning — that doesn't match any clause).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions