Remove stateful context from Env for guards
This commit is contained in:
parent
ac7a3f98ab
commit
eadd00cc4d
@ -1396,7 +1396,7 @@ infer_letfun1(Env0, {letfun, Attrib, Fun = {id, NameAttrib, Name}, Args, What, G
|
|||||||
Env = Env0#env{ stateful = aeso_syntax:get_ann(stateful, Attrib, false),
|
Env = Env0#env{ stateful = aeso_syntax:get_ann(stateful, Attrib, false),
|
||||||
current_function = Fun },
|
current_function = Fun },
|
||||||
{NewEnv, {typed, _, {tuple, _, TypedArgs}, {tuple_t, _, ArgTypes}}} = infer_pattern(Env, {tuple, [{origin, system} | NameAttrib], Args}),
|
{NewEnv, {typed, _, {tuple, _, TypedArgs}, {tuple_t, _, ArgTypes}}} = infer_pattern(Env, {tuple, [{origin, system} | NameAttrib], Args}),
|
||||||
NewGuard = check_expr(NewEnv, Guard, {id, Attrib, "bool"}),
|
NewGuard = check_expr(NewEnv#env{ stateful = false }, Guard, {id, Attrib, "bool"}),
|
||||||
ExpectedType = check_type(Env, arg_type(NameAttrib, What)),
|
ExpectedType = check_type(Env, arg_type(NameAttrib, What)),
|
||||||
NewBody={typed, _, _, ResultType} = check_expr(NewEnv, Body, ExpectedType),
|
NewBody={typed, _, _, ResultType} = check_expr(NewEnv, Body, ExpectedType),
|
||||||
NamedArgs = [],
|
NamedArgs = [],
|
||||||
@ -1913,7 +1913,7 @@ infer_case(Env, Attrs, Pattern, Guard, ExprType, Branch, SwitchType) ->
|
|||||||
none ->
|
none ->
|
||||||
{'case', Attrs, NewPattern, NewBranch};
|
{'case', Attrs, NewPattern, NewBranch};
|
||||||
_ ->
|
_ ->
|
||||||
NewGuard = check_expr(NewEnv, Guard, {id, Attrs, "bool"}),
|
NewGuard = check_expr(NewEnv#env{ stateful = false }, Guard, {id, Attrs, "bool"}),
|
||||||
{'case', Attrs, NewPattern, NewGuard, NewBranch}
|
{'case', Attrs, NewPattern, NewGuard, NewBranch}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user