Skip to content

Commit 2bd3d57

Browse files
VLanvinmeta-codesync[bot]
authored andcommitted
Clean-up old error messages
Summary: Use new error message generation for callback type errors, add corresponding test Cleanup old error message generation Reviewed By: TD5 Differential Revision: D88941623 fbshipit-source-id: 262c2031c7d19ad2528ef63a5d73d146fd84d408
1 parent eb5e0ab commit 2bd3d57

File tree

4 files changed

+65
-22
lines changed

4 files changed

+65
-22
lines changed
Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
error: incorrect_return_type_in_cb_implementation (See https://fb.me/eqwalizer_errors#incorrect_return_type_in_cb_implementation)
2-
┌─ check/src/callbacks3_neg.erl:12:1
2+
┌─ check/src/callbacks3_neg.erl:13:1
33
4-
12 │ -behavior(gen_server).
4+
13 │ -behavior(gen_server).
5+
│ ^^^^^^^^^^^^^^^^^^^^^ Incorrect return type for implementation of gen_server:handle_cast/2.
6+
Expected: {'noreply', term()} | {'noreply', term(), timeout() | 'hibernate' | {'continue', term()}} | {'stop', term(), term()}
7+
Got: 'wrong_ret'
8+
9+
error: incorrect_return_type_in_cb_implementation (See https://fb.me/eqwalizer_errors#incorrect_return_type_in_cb_implementation)
10+
┌─ check/src/callbacks3_neg.erl:13:1
11+
12+
13 │ -behavior(gen_server).
513
│ ^^^^^^^^^^^^^^^^^^^^^
614
│ │
7-
│ Incorrect return type for implementation of gen_server:handle_cast/2. Expected: {'noreply', term()} | {'noreply', term(), timeout() | 'hibernate' | {'continue', term()}} | {'stop', term(), term()}, Got: 'wrong_ret'.
15+
│ Incorrect return type for implementation of gen_server:handle_info/2.
16+
Expected: {'noreply', term()} | {'noreply', term(), timeout() | 'hibernate' | {'continue', term()}} | {'stop', term(), term()}
17+
Got: {'noreply', 'ok', 'wrong_atom'}
818
919

10-
'wrong_ret' is not compatible with {'noreply', term()} | {'noreply', term(), timeout() | 'hibernate' | {'continue', term()}} | {'stop', term(), term()}
11-
because
12-
'wrong_ret' is not compatible with {'noreply', term()}
20+
Because in the expression's type:
21+
{ 'noreply', 'ok',
22+
Here the type is: 'wrong_atom'
23+
Context expects type: 'infinity' | number() | 'hibernate' | {'continue', term()}
24+
No candidate matches in the expected union.
25+
}
1326

14-
1 ERROR
27+
2 ERRORS
Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
error: incorrect_return_type_in_cb_implementation (See https://fb.me/eqwalizer_errors#incorrect_return_type_in_cb_implementation)
2-
┌─ check/src/callbacks3_neg.erl:12:1
2+
┌─ check/src/callbacks3_neg.erl:13:1
33
4-
12 │ -behavior(gen_server).
4+
13 │ -behavior(gen_server).
5+
│ ^^^^^^^^^^^^^^^^^^^^^ Incorrect return type for implementation of gen_server:handle_cast/2.
6+
Expected: {'noreply', term()} | {'noreply', term(), timeout() | 'hibernate' | {'continue', term()}} | {'stop', term(), term()}
7+
Got: 'wrong_ret'
8+
9+
error: incorrect_return_type_in_cb_implementation (See https://fb.me/eqwalizer_errors#incorrect_return_type_in_cb_implementation)
10+
┌─ check/src/callbacks3_neg.erl:13:1
11+
12+
13 │ -behavior(gen_server).
513
│ ^^^^^^^^^^^^^^^^^^^^^
614
│ │
7-
│ Incorrect return type for implementation of gen_server:handle_cast/2. Expected: {'noreply', term()} | {'noreply', term(), timeout() | 'hibernate' | {'continue', term()}} | {'stop', term(), term()}, Got: 'wrong_ret'.
15+
│ Incorrect return type for implementation of gen_server:handle_info/2.
16+
Expected: {'noreply', term()} | {'noreply', term(), timeout() | 'hibernate' | {'continue', term()}} | {'stop', term(), term()}
17+
Got: {'noreply', 'ok', 'wrong_atom'}
818
919

10-
'wrong_ret' is not compatible with {'noreply', term()} | {'noreply', term(), timeout() | 'hibernate' | {'continue', term()}} | {'stop', term(), term()}
11-
because
12-
'wrong_ret' is not compatible with {'noreply', term()}
20+
Because in the expression's type:
21+
{ 'noreply', 'ok',
22+
Here the type is: 'wrong_atom'
23+
Context expects type: 'infinity' | number() | 'hibernate' | {'continue', term()}
24+
No candidate matches in the expected union.
25+
}
1326

14-
1 ERROR
27+
2 ERRORS
Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
error: incorrect_return_type_in_cb_implementation (See https://fb.me/eqwalizer_errors#incorrect_return_type_in_cb_implementation)
2-
┌─ check/src/callbacks3_neg.erl:12:1
2+
┌─ check/src/callbacks3_neg.erl:13:1
33
4-
12 │ -behavior(gen_server).
4+
13 │ -behavior(gen_server).
5+
│ ^^^^^^^^^^^^^^^^^^^^^ Incorrect return type for implementation of gen_server:handle_cast/2.
6+
Expected: {'noreply', term()} | {'noreply', term(), gen_server:action()} | {'stop', term(), term()}
7+
Got: 'wrong_ret'
8+
9+
error: incorrect_return_type_in_cb_implementation (See https://fb.me/eqwalizer_errors#incorrect_return_type_in_cb_implementation)
10+
┌─ check/src/callbacks3_neg.erl:13:1
11+
12+
13 │ -behavior(gen_server).
513
│ ^^^^^^^^^^^^^^^^^^^^^
614
│ │
7-
│ Incorrect return type for implementation of gen_server:handle_cast/2. Expected: {'noreply', term()} | {'noreply', term(), gen_server:action()} | {'stop', term(), term()}, Got: 'wrong_ret'.
15+
│ Incorrect return type for implementation of gen_server:handle_info/2.
16+
Expected: {'noreply', term()} | {'noreply', term(), gen_server:action()} | {'stop', term(), term()}
17+
Got: {'noreply', 'ok', 'wrong_atom'}
818
919

10-
'wrong_ret' is not compatible with {'noreply', term()} | {'noreply', term(), gen_server:action()} | {'stop', term(), term()}
11-
because
12-
'wrong_ret' is not compatible with {'noreply', term()}
20+
Because in the expression's type:
21+
{ 'noreply', 'ok',
22+
Here the type is: 'wrong_atom'
23+
Context expects type: gen_server:action()
24+
}
1325

14-
1 ERROR
26+
2 ERRORS

test_projects/eqwalizer_tests/check/src/callbacks3_neg.erl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
-export([
88
init/1,
99
handle_call/3,
10-
handle_cast/2
10+
handle_cast/2,
11+
handle_info/2
1112
]).
1213
-behavior(gen_server).
1314

@@ -19,3 +20,7 @@ handle_call(_, _From, State) ->
1920
-spec handle_cast(ok, ok) -> wrong_ret.
2021
handle_cast(_, _) ->
2122
wrong_ret.
23+
24+
-spec handle_info(ok, ok) -> {noreply, ok, wrong_atom}.
25+
handle_info(_, _) ->
26+
{noreply, ok, wrong_atom}.

0 commit comments

Comments
 (0)