Elixir and Erlang/OTP versions
Erlang/OTP 28 [erts-16.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Elixir 1.20.0-rc.4 (603602e) (compiled with Erlang/OTP 28)
Operating system
any
Current behavior
The pattern match in
|
is_sigil({Name, 2}) -> |
|
case atom_to_list(Name) of |
|
"sigil_" ++ Letters -> |
|
case Letters of |
|
[L] when L >= $a, L =< $z -> true; |
|
[] -> false; |
|
[H|T] when H >= $A, H =< $Z -> |
|
lists:all(fun(L) -> (L >= $0 andalso L =< $9) |
|
orelse (L>= $A andalso L =< $Z) |
|
end, T) |
|
end; |
|
_ -> |
|
false |
|
end; |
|
is_sigil(_) -> |
|
false. |
does not cover functions and macros with
sigil_ prefix that are not sigils
This code triggers the crash
defmodule Helpers do
def sigil_ab(content, _modifiers), do: content
def helper(x), do: x
end
defmodule Some do
import Helpers, only: :sigils
end
** (CaseClauseError) no case clause matching:
~c"ab"
(elixir 1.20.0-rc.4) src/elixir_import.erl:191: :elixir_import.is_sigil/1
(elixir 1.20.0-rc.4) src/elixir_import.erl:186: :elixir_import."-filter_sigils/1-lists^filter/1-0-"/2
(elixir 1.20.0-rc.4) src/elixir_import.erl:186: :elixir_import."-filter_sigils/1-lists^filter/1-0-"/2
(elixir 1.20.0-rc.4) src/elixir_import.erl:120: :elixir_import.calculate_except/7
(elixir 1.20.0-rc.4) src/elixir_import.erl:61: :elixir_import.import_only_except/7
(elixir 1.20.0-rc.4) src/elixir_import.erl:19: :elixir_import.import/7
(elixir 1.20.0-rc.4) src/elixir_expand.erl:157: :elixir_expand.expand/3
iex:2: (file)
Expected behavior
Elixir compiler should either reject sigil_ prefix or do not crash when importing non sigil symbols
Elixir and Erlang/OTP versions
Erlang/OTP 28 [erts-16.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Elixir 1.20.0-rc.4 (603602e) (compiled with Erlang/OTP 28)
Operating system
any
Current behavior
The pattern match in
elixir/lib/elixir/src/elixir_import.erl
Lines 188 to 203 in 8011552
does not cover functions and macros with
sigil_prefix that are not sigilsThis code triggers the crash
Expected behavior
Elixir compiler should either reject
sigil_prefix or do not crash when importing non sigil symbols