elixir-lang/elixir — pull request #1793 by fishcakez (2013-10-22 17:33:07+00:00)
Title: Fix Inspect.Algebra.format/3 to handle :infinity correctly

Previous `Inspect.Algebra.format/3` could not handle `:infinity` as a first argument. This patch also corrects some related type specs. These were found by the following dialyzer warnings from #1569:

```
lib/elixir/lib/inspect/algebra.ex:279: Fun application with arguments (d::any(),'doc_nil' | binary() | {'doc_break',binary()} | {'doc_group','doc_nil' | binary() | {_,_} | {_,_,_}} | {'doc_cons','doc_nil' | binary() | {_,_} | {_,_,_},'doc_nil' | binary() | {_,_} | {_,_,_}} | {'doc_nest',non_neg_integer(),'doc_nil' | binary() | {_,_} | {_,_,_}}) will fail since the function has type fun((_,['doc_nil' | binary() | {'doc_break',binary()} | {'doc_group','doc_nil' | binary() | {_,_} | {_,_,_}} | {'doc_cons','doc_nil' | binary() | {_,_} | {_,_,_},'doc_nil' | binary() | {_,_} | {_,_,_}} | {'doc_nest',non_neg_integer(),'doc_nil' | binary() | {_,_} | {_,_,_}}]) -> 'doc_nil' | binary() | {'doc_break',binary()} | {'doc_group','doc_nil' | binary() | {_,_} | {_,_,_}} | {'doc_cons','doc_nil' | binary() | {_,_} | {_,_,_},'doc_nil' | binary() | {_,_} | {_,_,_}} | {'doc_nest',non_neg_integer(),'doc_nil' | binary() | {_,_} | {_,_,_}})
lib/elixir/lib/kernel.ex:2022: The call 'Elixir.Inspect.Algebra':pretty('doc_nil' | binary() | {'doc_break',binary()} | {'doc_group','doc_nil' | binary() | {_,_} | {_,_,_}} | {'doc_cons','doc_nil' | binary() | {_,_} | {_,_,_},'doc_nil' | binary() | {_,_} | {_,_,_}} | {'doc_nest',non_neg_integer(),'doc_nil' | binary() | {_,_} | {_,_,_}},'infinity') will never return since it differs in the 2nd argument from the success typing arguments: ('doc_nil' | binary() | {_,_} | {_,_,_},integer())
```