Today charlist interpolation is quivalent to calling `String.to_charlist`
on the equivalent string interpolation. It can be more efficient by
leveraging chardata support in the `:unicode` module and encoding as a
list of literal binaries and results of `Kernel.to_string` calls for the
interpolated segments.
Prior to this patch, if a module depends on the struct of
another module and that other module depends on the struct
of the first module inside typespecs, it would lead to a
compiler deadlock, which this deadlock would not happen
in "regular code".
This commit also adds a test to ensure @enforce_keys are
not enforced when expanding typespecs.
For now, we are using a compiler private API, but we should
provide a public version for it in a future commit.
- Replace "two element tuples" with "two-element tuples" for every number in 1..10
- Replace "2-element tuples" with "two-element tuples" for every number
- "1-based" with "one-based"
- "0-based" with "zero-based"
Closes#8285.
This warning has to be removed because all of the forms were
unified in v1.7, making case/with/if to behave the same.
That leads to undesired warnings in cases such as:
a = 1
with {:ok, a} <- my_fun(a) do
:ok
end
This speeds up the Elixir compiler from 5-10% as we no
longer do duplicate work on erl_lint and expand_records.
We also avoid the copying of messages by controlling
exactly when the compiler spawns new processes.
Refers to #5800
Performs the erl_lint check "underspecified_opaque, {TypeName, Arity}}" in Elixir.
After reading the Erlang/OTP codebase, it seems an "underspecified opaque" is an opaque type of arity 0 with a spec of "term" or "any".
Optimizes :maps.put/3 to a VM operation instead of a remote call, including nested calls to it.
It does the same for :maps.merge/2 with a simple map on the right side.
Closes#7353
When left side is expanded but become invalid, the expansion result in the AST leaking for the user, for example:
```
iex(1)> __ENV__.line.foo
{{:., [line: 1], [1, :foo]}, [line: 1], []}
```
This checks the expanded left to ensure that it's safe