Skip to content

Commit

Permalink
Fix test/known_problems/should_pass/poly_should_pass.erl
Browse files Browse the repository at this point in the history
  • Loading branch information
erszcz committed Oct 11, 2024
1 parent b49d297 commit fb57dfe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
15 changes: 1 addition & 14 deletions test/known_problems/should_pass/poly_should_pass.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,7 @@

-gradualizer([solve_constraints]).

-export([find1/0,
l/0]).

-spec lookup(T1, [{T1, T2}]) -> (none | T2).
lookup(_, []) -> none;
lookup(K, [{K, V}|_]) -> V;
lookup(K, [_|KVs]) -> lookup(K, KVs).

-spec find1() -> string().
find1() ->
case lookup(0, [{0, "s"}]) of
none -> "default";
V -> V
end.
-export([l/0]).

-type t1() :: {}.
-type t2() :: binary().
Expand Down
15 changes: 14 additions & 1 deletion test/should_pass/poly_pass.erl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
invariant_tyvar1/1,
invariant_tyvar2/1,
use_enum_map1/1,
use_enum_map2/1
use_enum_map2/1,
find1/0
]).

-gradualizer([solve_constraints]).
Expand Down Expand Up @@ -216,3 +217,15 @@ use_enum_map1(Numbers) ->
-spec use_enum_map2(#{'__struct__' := some_struct}) -> [boolean()].
use_enum_map2(SomeStruct) ->
enum_map(SomeStruct, fun positive/1).

-spec lookup(T1, [{T1, T2}]) -> (none | T2).
lookup(_, []) -> none;
lookup(K, [{K, V}|_]) -> V;
lookup(K, [_|KVs]) -> lookup(K, KVs).

-spec find1() -> string().
find1() ->
case lookup(0, [{0, "s"}]) of
none -> "default";
V -> V
end.

0 comments on commit fb57dfe

Please sign in to comment.