Fix missing type annotation in list comprehension body

This commit is contained in:
Ulf Norell 2019-12-12 08:50:17 +01:00
parent 64e2fff91a
commit d844c4d276
3 changed files with 6 additions and 1 deletions

View File

@ -1138,7 +1138,7 @@ infer_expr(Env, {list, As, Elems}) ->
NewElems = [check_expr(Env, X, ElemType) || X <- Elems],
{typed, As, {list, As, NewElems}, {app_t, As, {id, As, "list"}, [ElemType]}};
infer_expr(Env, {list_comp, As, Yield, []}) ->
{typed, _, TypedYield, Type} = infer_expr(Env, Yield),
{typed, _, _, Type} = TypedYield = infer_expr(Env, Yield),
{typed, As, {list_comp, As, TypedYield, []}, {app_t, As, {id, As, "list"}, [Type]}};
infer_expr(Env, {list_comp, As, Yield, [{comprehension_bind, Arg, BExpr}|Rest]}) ->
BindVarType = fresh_uvar(As),

View File

@ -138,6 +138,7 @@ compilable_contracts() ->
"test",
"builtin_bug",
"builtin_map_get_bug",
"lc_record_bug",
"nodeadcode",
"deadcode",
"variant_types",

View File

@ -0,0 +1,4 @@
contract Foo =
record r = {x : int}
// Crashed in the backend due to missing type annotation on the lc body.
entrypoint lc(xs) = [ {x = x} | x <- xs ]