Skip to content

Commit

Permalink
Cleanup for dialyzer, removed typer bug tests
Browse files Browse the repository at this point in the history
Filed bug #57 as the typer bug isn't limited to function arg patterns.
  • Loading branch information
j14159 committed Dec 1, 2016
1 parent 680a410 commit 751eac2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 34 deletions.
6 changes: 0 additions & 6 deletions src/mlfe_ast_gen.erl
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ drop_dupes_preserve_order([H|T], [H|_]=Memo) ->
drop_dupes_preserve_order([H|T], Memo) ->
drop_dupes_preserve_order(T, [H|Memo]).

rebind_fun_pattern_args([], _NV, _Map, _Env, Memo) ->
lists:reverse(Memo);
rebind_fun_pattern_args([A|T], NV, MN, Map, Memo) ->
{NV2, Map2, A2} = make_bindings(NV, MN, Map, A),
rebind_fun_pattern_args(T, NV2, MN, Map2, [A2|Memo]).

rebind_and_validate_module(_, {error, _} = Err) ->
Err;
rebind_and_validate_module(NextVarNum, {ok, #mlfe_module{}=Mod}) ->
Expand Down
2 changes: 1 addition & 1 deletion src/mlfe_codegen.erl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ gen_fun_patterns(Env, #mlfe_fun_def{name={symbol, _, N}, arity=A, versions=Vs})
VarNames = ["pat_var_" ++ integer_to_list(X) || X <- lists:seq(1, A)],
%% Nest matches:
FName = cerl:c_fname(list_to_atom(N), A),
Args = [cerl:c_var(cerl:c_atom(X)) || X <- VarNames],
Args = [cerl:c_var(list_to_atom(X)) || X <- VarNames],
[TopVar|_] = VarNames,
B = cerl:c_case(
cerl:c_values(Args),
Expand Down
27 changes: 0 additions & 27 deletions src/mlfe_typer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4004,33 +4004,6 @@ function_argument_pattern_test_() ->
#adt{vars=[{_, {unbound, B, _}}]}}}]}},
module_typ_and_parse(Code))
end
, fun() ->
Code =
"module fun_pattern_with_adt\n\n"
"type option 'a = None | Some 'a\n\n"
"my_map _ None = None\n\n"
"my_map f Some a = Some (f a)\n\n"
"doubler x = x * x\n\n"
"foo = my_map doubler 2",
?assertMatch(
{error, {cannot_unify, _, _, #adt{}, t_int}},
module_typ_and_parse(Code))
end
, fun() ->
Code =
"module fun_pattern_with_adt\n\n"
"type option 'a = None | Some 'a\n\n"
"my_map _ None = None\n\n"
"my_map f Some a = Some (f a)\n\n"
"doubler x = x * x\n\n"
"get_x {x=x} = x\n\n"
"foo () = "
" let rec = {x=1, y=2} in "
" my_map doubler (get_x rec)",
?assertMatch(
{error, {cannot_unify, _, _, #adt{}, t_int}},
module_typ_and_parse(Code))
end
].

no_process_leak_test() ->
Expand Down

0 comments on commit 751eac2

Please sign in to comment.