Closed
Description
Elixir and Erlang/OTP versions
Versions that fail:
- Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]; Elixir 1.18.0-dev (43788c0) (compiled with Erlang/OTP 25)
- Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]; Elixir 1.17.0-rc.0 (a2600ea) (compiled with Erlang/OTP 25)
- Erlang/OTP 25 [erts-13.2.2.6] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]; 1.17.0-rc.0 (a2600ea) (compiled with Erlang/OTP 25)
- Erlang/OTP 27 [erts-15.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]; Elixir 1.17.0-rc.0 (a2600ea) (compiled with Erlang/OTP 25)
Versions that works:
- Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]; 1.16.3 (compiled with Erlang/OTP 24)
- likely Elixir 1.16.1, but didn't reproduce with the test case
Operating system
Linux
Current behavior
STR:
mix new debug
- put
Regex.source(~r/foo/u)
into the auto-generatedlib/debug.ex
, e.g. intohello/0
- add
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}
tomix.exs
andmix deps.get
etc mix dialyzer
Expected behavior
In versions that work, Dialyzer (or Dialyxer) doesn't report any issues.
In the newer versions, it is not happy:
Total errors: 1, Skipped: 0, Unnecessary Skips: 0
done in 0m0.96s
lib/debug.ex:15:no_return
Function hello/0 has no local return.
________________________________________________________________________________
done (warnings were emitted)
Halting VM with exit status 2
It seems to be related to sigil_r
with unicode modifier being actually processed, i.e. passed to some Regex
or String
function. Note that the actual regex continues to work, and only Dialyzer is complaining. So if there is an edge case that triggers the error condition that makes Dialyzer complain, I have not found it yet.
Findings so far (works = Dialyzer reports no error):
- The same issue appears when using e.g.
String.replace
- Unicode in the subject works (e.g.
String.match?("josé", ~r/^[[:lower:]]+$/)
from the docs continues to work) - Unicode in regex without unicode modifier works, e.g.
Regex.source(~r/ẞÄẞ®₃©™§/)
produces no errors - "bare"
sigil_r
is ok, too:IO.inspect(~r{foo}u)
- this example
Regex.replace(~r/\s/u, "Unicode\u00A0spaces", "-")
from the regex docs also fails. At a glance it's part of the doctests, so running Dialyzer on those should've caught the issue. Out of scope for this bug report for sure, but maybe a worthwhile investigation to prevent regressions.
Metadata
Metadata
Assignees
Labels
No labels