For such a use, you need a type annotation:

fun concat_exec_imgact {i:int} (pagesizes: ulint i): ulint = let
val
psize =
(
if
pagesizes > 0UL
then pagesizes else 1UL
) : [i:pos] ulint(i)
in
  concat_rnd_base(psize)
end

On Wed, Mar 31, 2021 at 8:31 AM Kiwamu Okabe <[email protected]> wrote:

> Dear all,
>
> I wrote following ATS code:
>
> ```ats
> #include "share/atspre_define.hats"
> #include "share/atspre_staload.hats"
>
> fun concat_rnd_base {i:int | i > 0}  (align: ulint i): ulint =
>   undefined()
>
> fun concat_exec_imgact {i:int} (pagesizes: ulint i): ulint = let
>     val psize = if pagesizes > 0UL then pagesizes else 1UL
>   in
>     concat_rnd_base(psize)
>   end
>
> implement main0 () = {
> }
> ```
>
> but above code causes following error:
>
> ```
> $ patscc main.dats
> .../main.dats: 302(line=10, offs=21) -- 307(line=10, offs=26):
> error(3): unsolved constraint: C3NSTRprop(C3TKmain();
> S2Eeqeq(S2Evar(i(8481)); S2Eintinf
> (1)))
> ```
>
> I belive the `psize` depends on `{i:int | i > 0}`.
> How to avoid the unsolved constraint error?
>
> Best regards,
> --
> 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/CAEvX6dnue3oRHsd0oFR9R1Y0WjsGfOu2YfYJ2pvpOm8mBHQBPQ%40mail.gmail.com
> .
>

-- 
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/CAPPSPLrrAa7sxyhFQgDySRrL6gDd7vdQRdf%2BBjPdnzapckDPBg%40mail.gmail.com.

Reply via email to