You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: incompatible_types
┌─ src/t.erl:9:22
│
9 │ {ok, Int} ?= convert_to_int(Str),
│ ^^^^^^^^^^^^^^^^^^^
│ │
│ convert_to_int(Str).
Expression has type: {'ok', number()} | {'error', 'bad_int'}
Context expected type: {'ok', string()} | {'error', 'bad_int'}
See https://fb.me/eqwalizer_errors#incompatible_types
│
{'ok', number()} | {'error', 'bad_int'} is not compatible with {'ok', string()} | {'error', 'bad_int'}
because
{'ok', number()} is not compatible with {'ok', string()} | {'error', 'bad_int'}
because
at tuple index 2:
{'ok', number()} is not compatible with {'ok', string()}
because
number() is not compatible with string()
Everything works well If i replace it with equivalent case expression:
-specmult2(string()) -> {ok, string()} | {error, bad_int}.
mult2(Str) ->caseconvert_to_int(Str) of
{ok, Int} ->
{ok, integer_to_list(Int*2)};
Other ->
Otherend.
The text was updated successfully, but these errors were encountered:
Yes, that is a false positive. Unfortunately, eqwalizer has very limited support for handling maybe expressions and we don't have any plans to improve it in the nearest future.
This simplified code:
leads to issue:
Everything works well If i replace it with equivalent case expression:
The text was updated successfully, but these errors were encountered: