-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
ELP has trouble finding type spec violations when using A = B expressions.
To Reproduce
Here are three equivalent code snippets in a module example.erl, only the error in t3 is detected.
-module(example).
-compile([export_all, nowarn_export_all]).
-spec t1() -> ok.
t1() ->
[] = foo.
-spec t2() -> ok.
t2() ->
case foo of
A = [] -> A
end.
-spec t3() -> ok.
t3() ->
case foo of
[] -> []
end.Expected behavior
Similar to t3, a type error in t2 and t1 should be detected.
Actual behavior
Only a type error in t3 is detected.
> ./elp eqwalize-all
Loading build info
Loading applications ████████████████████
Seeding database
Compiling dependencies
Gathering modules ████████████████████ 3/3
Parsing modules
EqWAlizing
error: incompatible_types (See https://fb.me/eqwalizer_errors#incompatible_types)
┌─ src/example.erl:19:11
│
19 │ [] -> []
│ ^^ [].
Expression has type: []
Context expected type: 'ok'
1 ERRORContext
ELP release with eqwalizer support enabled, and VS code plugin.
./elp version
elp 1.1.0+build-2025-11-04
Example project attached.
Is there a reason why type information is lost for the bound variable A in t2 or why [] is not used as the return type for the expression [] = foo in t1?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working