processone / processone/fast_xml

Dialyzer fails with Erlang/OTP 28

Open
#52 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Erlang
Stars
137
Forks
44
Avg merge
3d 57m
Merged PRs (30d)
1

Description

fast_xml uses functions from the erl_types module from Erlang/OTP. In Erlang 28, this module got changes, and now dialyzer fails:

$ rebar3 dialyzer
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling fast_xml
===> Dialyzer starting, this may take a while...
===> Updating plt...
===> Resolving project files...
===> Updating base plt...
===> Resolving base files...
===> Checking 222 files in /home/bernar/.cache/rebar3/rebar3_28.0_plt...
===> Copying /home/bernar/.cache/rebar3/rebar3_28.0_plt to /home/bernar/e/git/librerias/fast_xml/_build/default/rebar3_28.0_plt...
===> Checking 222 files in _build/default/rebar3_28.0_plt...
===> Adding 113 files to _build/default/rebar3_28.0_plt...
===> Doing success typing analysis...
===> Resolving project warning files...
===> Analyzing 9 files with _build/default/rebar3_28.0_plt...

src/fxml_gen.erl

Line 3110 Column 57: The pattern {'type', _, 'list', [T]}
 can never match the type
 (erl_types:erl_type() :: 'any' | 'none' | 'opaque' | 'unit' | {'c',atom(),_,'float' | 'integer' | 'nonempty' | 'pid' | 'port' | 'reference' | 'unknown' | {_,_}})

Line 3112 Column 57: The pattern {'remote_type', _, [{'atom', _, 'erlang'}, {'atom', _, 'timestamp'}, []]}
 can never match the type
 (erl_types:erl_type() :: 'any' | 'none' | 'opaque' | 'unit' | {'c',atom(),_,'float' | 'integer' | 'nonempty' | 'pid' | 'port' | 'reference' | 'unknown' | {_,_}})

Line 3119 Column 57: The pattern {'remote_type', _, [{'atom', _, 'inet'}, {'atom', _, 'ip_address'}, []]}
 can never match the type
 (erl_types:erl_type() :: 'any' | 'none' | 'opaque' | 'unit' | {'c',atom(),_,'float' | 'integer' | 'nonempty' | 'pid' | 'port' | 'reference' | 'unknown' | {_,_}})

Line 3123 Column 57: The pattern {'remote_type', _, [{'atom', _, 'jid'}, {'atom', _, 'jid'}, []]}
 can never match the type
 (erl_types:erl_type() :: 'any' | 'none' | 'opaque' | 'unit' | {'c',atom(),_,'float' | 'integer' | 'nonempty' | 'pid' | 'port' | 'reference' | 'unknown' | {_,_}})

Line 3127 Column 57: The pattern {'type', _, 'union', _}
 can never match the type
 (erl_types:erl_type() :: 'any' | 'none' | 'opaque' | 'unit' | {'c',atom(),_,'float' | 'integer' | 'nonempty' | 'pid' | 'port' | 'reference' | 'unknown' | {_,_}})

Line 3686 Column 22: Guard test 'c' == 'remote_type' can never succeed

Line 4216 Column 15: The call erl_types:t_from_form(Spec::any(), sets:set(_), {'type', {'mod', 'foo', 1}, "mod.erl"}, atom() | ets:tid(), #{}, erl_types:cache())
 will never return since the success typing is
 ({'ann_type' | 'atom' | 'char' | 'integer' | 'remote_type' | 'var',erl_anno:anno(),atom() | [any()] | non_neg_integer()} | {'op',erl_anno:anno(),'+' | '-' | 'bnot' | 'not',_} | {'type',erl_anno:anno(),atom(),'any' | [any()]} | {'user_type',erl_anno:anno(),atom(),[any()]} | {'op',erl_anno:anno(),atom(),_,_}, 'replace_by_none' | ets:tid(), {'record',{atom(),atom(),byte()},string()} | {'spec',{atom(),atom(),byte()},string()} | {'type',{atom(),atom(),byte()},string()}, 'undefined' | ets:tid(), #{atom() | integer()=>(erl_types:erl_type() :: 'any' | 'none' | 'opaque' | 'unit' | {'c',atom(),_,'float' | 'integer' | 'nonempty' | 'pid' | 'port' | 'reference' | 'unknown' | {_,_}})}, erl_types:cache()) -> {(erl_types:erl_type() :: 'any' | 'none' | 'opaque' | 'unit' | {'c',atom(),_,'float' | 'integer' | 'nonempty' | 'pid' | 'port' | 'reference' | 'unknown' | {_,_}}),erl_types:cache()}
 and the contract is (parse_form(), exported_type_table(), site(), mod_type_table(), var_table(), cache()) -> {erl_type(),cache()}

Line 4225 Column 11: Call to missing or unexported function erl_types:t_opaque_from_records/1

===> Warnings written to _build/default/28.0.dialyzer_warnings
===> Warnings occurred running dialyzer: 8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/fxml_gen.erl around lines 3110, 3686, and 4216-4225, then run rebar3 dialyzer with Erlang/OTP 28 to reproduce the warnings. Trace the erl_types calls and pattern assumptions involved; done means dialyzer completes without the reported warnings or missing-function error.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.