Open kai-e opened 5 years ago
Lifting the binding prevents the error:
| L_p_4 -> let hErp_r = array_bget ( r.x, (0 : U32) ) !r in
( w
, #{ hErp_pv_0
, r = r {b = if hErp_r == '0' then False else True} }
, Continue L_p_4 )
even smaller example:
type A
array_bget : all x. (A!, U32) -> x
type Ra = #{ x : A, b : Bool }
type L_p = < L_p_4 >
type V_p = #{ hErp_pv_0 : U8, r : Ra }
delta_p : Ra -> Ra
delta_p r = r {b = let y = array_bget ( r.x, 0 : U32 ) !r in y}
We know the problem. I'll patch it sometime soon.
It keeps shrinking.
type A
f : (A!) -> Bool
type R = #{ x : A, b : Bool }
g : R -> R
g r = r {b = let y = f ( r.x ) !r in y}
@liamoc seems that minigent has the same issue:
f : A! -> Bool;
g : { x : A, b : Bool }# -> { x : A, b : Bool }#;
g r = put r.b := let! (r) y = f (r.x) in y end end;
It doesn't crash though , right? Minigent doesn't try to generate a tree-structured typing proof.
no, but it doesn't reject the program.
Right, that's expected behaviour, seeing as I don't check that you use let!'ed variables in the RHS. To be fully compliant with the typing rules, I should, but I didn't bother for now.
Ok, but what about the fact that r
is double-used in the put-expression?
well, that'd get fixed once you enforce the !-ed thing to be used in the rhs I guess.
This issue seems to be the same issue #399, which has been solved by detecting it by the type checker.
cogent -g
fails onwith