Skip to content

Commit a394b13

Browse files
committed
Fix test/should_pass/named_fun_pass.erl
1 parent 76c43e4 commit a394b13

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

test/should_fail/named_fun_fail.erl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-module(named_fun_fail).
22

3-
-export([bar/0, baz/1]).
3+
-export([bar/0, baz/1, sum/1]).
44

55
-spec foo(integer()) -> integer().
66
foo(N) -> N.
@@ -11,3 +11,12 @@ bar() -> foo(fun F(0) -> 0; F(X) -> F(X - 1) end).
1111
baz(I) ->
1212
O = I({}),
1313
O.
14+
15+
-spec sum([integer()]) -> integer().
16+
sum(Ints) ->
17+
F = fun Sum(Acc, [Int | Rest]) ->
18+
Sum(Acc + Int, Rest);
19+
Sum(Acc, []) ->
20+
Acc
21+
end,
22+
F(Ints).

test/should_pass/named_fun_pass.erl

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-module(named_fun_pass).
22

3-
-export([fac/1, sum/1]).
3+
-export([fac/1]).
44

55
-spec fac(integer()) -> integer().
66
fac(I) ->
@@ -10,14 +10,3 @@ fac(I) ->
1010
N*Fac(N-1)
1111
end,
1212
F(I).
13-
14-
%% Documents expected behaviour that named_fun gets type any() when
15-
%% infer is off in do_type_check_expr.
16-
-spec sum([integer()]) -> integer().
17-
sum(Ints) ->
18-
F = fun Sum(Acc, [Int | Rest]) ->
19-
Sum(Acc + Int, Rest);
20-
Sum(Acc, []) ->
21-
Acc
22-
end,
23-
F(Ints).

0 commit comments

Comments
 (0)