Non-printable arguments were killing the StringIO process, which
was killing the Logger handler associated to it. That was
causing some errors when users were running their test suites
with `capture_log: true`, because the proxy (Logger handler) was
not there when ExUnit.CaptureLog was trying to remove it.
Binary/bitstring matching allows to dynamically define the
`size` of the binary in certain conditions:
* if the `size` variable is defined prior to the pattern
match:
iex> size = 8
iex> <<a::size(size), rest::binary>> = "hello"
iex> a
104
* if the `size` variable is matched within the same
binary/bitstring match, prior to its use:
iex> <<name_size::size(8), name::binary-size(name_size), _rest::binary>> = <<5, "Frank the Walrus">>
iex> name
"Frank"
Other cases are considered illegal patterns, for example:
{name_size, <<name::binary-size(name_size), _rest::binary>>} = {5, "Frank the Walrus"}
This commit raises a `CompileError: undefined variable ...` for such cases.
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
Closes https://github.com/elixir-lang/elixir/issues/8564
This is my first attempt to contribute code to elixir, so please forgive me if this PR is completely naive.
Besides adding the `is_list/1` guards, I have updated the error message to specify that record specifications must use an atom `literal` as the name, to make it clear that the type `atom` is also not valid.
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
* `__protocol__` doesn't accept `:name`
* Elaborate on atoms that `__protocol__` accepts
* Change code example to doctest and fix it
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
Both sides of the range must be integers (after expansion), and
the "first" value must be greater than the "last" value.
These checks were previously performed by erl_lint.
We are uncertain this is the best API to expose this
information. Maybe it is best to expose this as a separate
calendar. That uses the week-based year and week-based
month in the Date/Time structs.
Now that ExDoc automatically links to functions in
Kernel and Kernel.SpecialForms, when linking to them in custom links,
we can leave out the module name.
Replaces "’" U+2019 RIGHT SINGLE QUOTATION MARK with
"'" U+0027 APOSTROPHE.
Replaces “ (U+201C LEFT DOUBLE QUOTATION MARK)
with " (U+0022 QUOTATION MARK).
Replace en-dash "–" (U+2013 EN DASH) with regular hyphen "-" (U+002D HYPHEN-MINUS).
While correct, it is reported in #4408 that it will not display correctly em-dashes in
Windows terminals.
README file is updated accordingly for consistency.
While https://en.wikipedia.org/wiki/Jaro–Winkler_distance uses an en-dash,
it is replaced to avoid the problem in Windows terminals, since Wikipedia
takes care of the redirection.
This fixes issue #8450 which was caused by the user of
`system_time` when `os_time` should have been used.
This commit improves the touch API by also allowing
posix times in `File.touch/2` and also document its
defaults. With this change, we phase out the remaining
use of Erlang's `:calendar` module in Elixir.