Dear Dambaev,

On Sun, Aug 30, 2020 at 2:21 PM Dambaev Alexander <[email protected]> wrote:
> compiler wants to keep 'opts_pf' at the end of the 'main', but it does not 
> care if it is the same as it was before, as we can't use 'opts' anymore, but 
> can use 'x' instead:
>
> ```
>     val (pf_oopts | x, count) = shared_unref(inp.sh)
>     val () = assertloc(count <= 1)
>     prval Some_v(pf_opts) = pf_oopts
>     val () = assertloc( x = addr@opts)
>     prval () = opts_pf := pf_opts
>     prval _ = $showtype (opts_pf)
>     prval _ = $showtype (opts)
>     prval _ = $showtype (x)
> ```
> will say:
> ```
> **SHOWTYPE[UP]**(/data/devel/ats2/closure/main.dats: 2733(line=103, offs=26) 
> -- 2740(line=103, offs=33)): S2Eat(S2Etyrec(flt0; npf=-1; 
> ip6po_hlim=S2Etop(knd=0; S2Ecst(int))); S2Evar(opts(8624))): 
> S2RTbas(S2RTBASimp(7; view))
> **SHOWTYPE[UP]**(/data/devel/ats2/closure/main.dats: 3021(line=110, offs=26) 
> -- 3028(line=110, offs=33)): S2Eat(S2EVar(5372); S2Evar(l$8793$8795(14582))): 
> S2RTbas(S2RTBASimp(7; view))
> /data/devel/ats2/closure/main.dats: 3055(line=111, offs=26) -- 3059(line=111, 
> offs=30): error(3): dereference cannot be performed: the proof search for 
> view located at [S2Evar(opts(8624))] failed to turn up a result.
> **SHOWTYPE[UP]**(/data/devel/ats2/closure/main.dats: 3055(line=111, offs=26) 
> -- 3059(line=111, offs=30)): S2Eerrexp(): S2RTbas(S2RTBASimp(1; t@ype))
> **SHOWTYPE[UP]**(/data/devel/ats2/closure/main.dats: 3086(line=112, offs=26) 
> -- 3087(line=112, offs=27)): S2Eapp(S2Ecst(ptr_addr_type); 
> S2Evar(l$8793$8795(14582))): S2RTbas(S2RTBASimp(0; type))
> ```
> so we have satisfied the compiler's constraint of 'view of local variable 
> should be preserved at the end of the function', but we haven't restored the 
> view to the original type, which should be more correct, I think.

Thank you for your easy-to-understand answer.
You answer means:

A. `opts_pf` depends on `S2Evar(l$8793$8795(14582))`
B. `x` also depends on `S2Evar(l$8793$8795(14582))`
C. A and B are made by `assertloc(x = addr@opts)`

Thanks,
-- 
Kiwamu Okabe at METASEPI DESIGN

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAEvX6dmsOwaeTLbekokSFT6GW1_zGntLuczAZ9st3TEWZ4bcnA%40mail.gmail.com.

Reply via email to