-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Open
Description
Elixir and Erlang/OTP versions
Erlang/OTP 28 [erts-16.1.1] [source] [64-bit] [smp:32:32] [ds:32:32:10] [async-threads:1] [jit:ns]
Elixir 1.19.1 (compiled with Erlang/OTP 28)
Operating system
x86_64-linux, Linux 6.17.4-xanmod1, NixOS, 25.11 (Xantusia), 25.11.20251031.2fb006b
Current behavior
This is basically my code:
case error do
%{message: message} when is_binary(message) ->
Logger.error("Error happened: #{message}")
_otherwise ->
Logger.error("Weird error happened: #{inspect(error)}")
endAnd compiler finds type violation on line 3 - message has type term() but expected a type that implements the String.Chars protocol. But there is a guard is_binary/1 on this case branch so the type is clear. Not sure if it is a bug or the type system is not able to work with guard in this place but it probably should not be reported as type violation.
Expected behavior
No type violation is reported.
Metadata
Metadata
Assignees
Labels
No labels