Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/elixir/lib/code.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ defmodule Code do
@doc since: "1.6.0"
@spec format_string!(binary, [format_opt]) :: iodata
def format_string!(string, opts \\ []) when is_binary(string) and is_list(opts) do
line_length = Keyword.get(opts, :line_length, 98)
{line_length, opts} = Keyword.pop(opts, :line_length, 98)

to_quoted_opts =
[
Expand Down
14 changes: 14 additions & 0 deletions lib/elixir/test/elixir/fixtures/dialyzer/regressions.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
defmodule Dialyzer.Regressions do
def io_inspect_opts do
IO.inspect(123, label: "foo", limit: :infinity)
end

def format_opts do
Code.format_string!("",
line_length: 120,
force_do_end_blocks: true,
locals_without_parens: true,
migrate: true
)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, we can probably add the IO.inspect one here too!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah I initially meant to do that - done 5586241

end
5 changes: 5 additions & 0 deletions lib/elixir/test/elixir/kernel/dialyzer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ defmodule Kernel.DialyzerTest do
assert_dialyze_no_warnings!(context)
end

test "no warning in various non-regression cases", context do
copy_beam!(context, Dialyzer.Regressions)
assert_dialyze_no_warnings!(context)
end

defp copy_beam!(context, module) do
name = "#{module}.beam"
File.cp!(Path.join(context.base_dir, name), Path.join(context.outdir, name))
Expand Down