fix minor bugs

This commit is contained in:
Ulf Norell 2019-04-30 09:51:46 +02:00
parent 0307a82433
commit 8559ab0628
2 changed files with 10 additions and 3 deletions

View File

@ -376,7 +376,8 @@ expr_to_fcode(Env, _Type, {app, _Ann, Fun, Args}) ->
expr_to_fcode(_Env, Type, Expr) -> expr_to_fcode(_Env, Type, Expr) ->
error({todo, {Expr, ':', Type}}). error({todo, {Expr, ':', Type}}).
binop_to_fcode(Op) when Op == '+'; Op == '-'; Op == '==' -> Op. binop_to_fcode(Op) when Op == '+'; Op == '-'; Op == '==';
Op == '::' -> Op.
-spec alts_to_fcode(env(), ftype(), var_name(), [aeso_syntax:alt()]) -> fsplit(). -spec alts_to_fcode(env(), ftype(), var_name(), [aeso_syntax:alt()]) -> fsplit().
alts_to_fcode(Env, Type, X, Alts) -> alts_to_fcode(Env, Type, X, Alts) ->

View File

@ -216,7 +216,8 @@ to_scode(_Env, {oracle_query_id, K}) ->
%% Not actually in FATE yet %% Not actually in FATE yet
[push(?i(aeb_fate_data:make_oracle_query(K)))]; [push(?i(aeb_fate_data:make_oracle_query(K)))];
to_scode(_Env, nil) -> aeb_fate_code:nil(?a); to_scode(_Env, nil) ->
[aeb_fate_code:nil(?a)];
to_scode(Env, {var, X}) -> to_scode(Env, {var, X}) ->
[push(lookup_var(Env, X))]; [push(lookup_var(Env, X))];
@ -882,7 +883,12 @@ r_prune_impossible_branches({switch, ?i(V), boolean, [False, True] = Alts, Def},
r_prune_impossible_branches(Variant = {i, _, {'VARIANT', R, ?i(_), ?i(Tag), ?i(_)}}, r_prune_impossible_branches(Variant = {i, _, {'VARIANT', R, ?i(_), ?i(Tag), ?i(_)}},
[{switch, R, Type, Alts, missing} | Code]) -> [{switch, R, Type, Alts, missing} | Code]) ->
case {R, lists:nth(Tag + 1, Alts)} of case {R, lists:nth(Tag + 1, Alts)} of
{_, missing} -> {[Variant, {switch, R, Type, [missing || _ <- Alts], missing}]}; {_, missing} ->
Alts1 = [missing || _ <- Alts],
case Alts == Alts1 of
true -> false;
false -> {[Variant, {switch, R, Type, Alts1, missing}], Code}
end;
{?a, Alt} -> {Alt, Code}; {?a, Alt} -> {Alt, Code};
{_, Alt} -> {_, Alt} ->
case live_in(R, Alt) of case live_in(R, Alt) of