Skip to content

Dialyzer error on Code.format_string! in 1.19 #14927

@angelikatyborska

Description

@angelikatyborska

Elixir and Erlang/OTP versions

$ elixir --version
Erlang/OTP 28 [erts-16.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Elixir 1.19.3 (compiled with Erlang/OTP 28)

Operating system

macOS 14.7.6 (23H626)

Current behavior

When I run dialyzer via dialyxir (1.4.7), this line of code:

Code.format_string!("", line_length: 120, force_do_end_blocks: true)

produces this error:

The function call will not succeed.

Code.format_string!(<<>>, [{:line_length, 120}, {:force_do_end_blocks, true}])

will never return since the 2nd arguments differ
from the success typing arguments:

(binary(), [
  {:column
   | :columns
   | :emit_warnings
   | :existing_atoms_only
   | :file
   | :indentation
   | :line
   | :literal_encoder
   | :static_atoms_encoder
   | :token_metadata
   | :unescape, boolean() | binary() | (... -> any) | non_neg_integer()}
])

In Elixir 1.18.1, this code did not produce any dialyzer error. AFAIK the API of this function didn't change. I'm using the formatting options that are listed in the docs: https://hexdocs.pm/elixir/Code.html#t:format_opt/0

Expected behavior

No dialyzer errors.

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