Type variables mentioned in local functions should not be flexible
(cc #112)
This commit is contained in:
parent
f27ba528d8
commit
062309e578
@ -1327,7 +1327,7 @@ infer_block(Env, _, [E], BlockType) ->
|
|||||||
[check_expr(Env, E, BlockType)];
|
[check_expr(Env, E, BlockType)];
|
||||||
infer_block(Env, Attrs, [Def={letfun, Ann, _, _, _, _}|Rest], BlockType) ->
|
infer_block(Env, Attrs, [Def={letfun, Ann, _, _, _, _}|Rest], BlockType) ->
|
||||||
{{Name, TypeSig}, LetFun} = infer_letfun(Env, Def),
|
{{Name, TypeSig}, LetFun} = infer_letfun(Env, Def),
|
||||||
FunT = freshen_type(Ann, typesig_to_fun_t(TypeSig)),
|
FunT = typesig_to_fun_t(TypeSig),
|
||||||
NewE = bind_var({id, Ann, Name}, FunT, Env),
|
NewE = bind_var({id, Ann, Name}, FunT, Env),
|
||||||
[LetFun|infer_block(NewE, Attrs, Rest, BlockType)];
|
[LetFun|infer_block(NewE, Attrs, Rest, BlockType)];
|
||||||
infer_block(Env, _, [{letval, Attrs, Pattern, Type, E}|Rest], BlockType) ->
|
infer_block(Env, _, [{letval, Attrs, Pattern, Type, E}|Rest], BlockType) ->
|
||||||
|
7
test/contracts/local_poly_fail.aes
Normal file
7
test/contracts/local_poly_fail.aes
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
contract Fail =
|
||||||
|
|
||||||
|
entrypoint tttt() : bool * int =
|
||||||
|
let f(x : 'a) : 'a = x
|
||||||
|
(f(true), f(1))
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user