There might be a logical error in your code:

bytes' > len + index

should be changed to

bytes' + index > len // or bytes' > len - index


On Fri, Nov 9, 2018 at 4:10 AM Kiwamu Okabe <[email protected]> wrote:

> On Fri, Nov 9, 2018 at 5:38 PM Chris Double <[email protected]>
> wrote:
> > I think for the same reason described here:
> > https://groups.google.com/d/msg/ats-lang-users/GLsPNt-aDzM/7AzKnaFzwr0J
> >
> > '||' is a macro and not given a dependent type.
>
> I try to just write `if (bytes' > len + index)` as following:
>
> ```
>     if ($UN.cast{int}{char} c < 0xc0)
>     then 1U else
>       let
>         (* Ok, it's 11xxxxxx, do a stupid decode *)
>         val (mask, bytes') = loop1 (c, 0x20U, 0x2U)
>       in
>         (* Invalid? Do it as a single byte Latin1 *)
>         if (bytes' > len + index)
>         then 1U
>         else
>           let
>             (* Ok, do the bytes *)
>             val value = loop2 (line, index, len, bytes', 1U,
>                                ($UN.cast{uint}{char} c) land (mask - 1U))
> ```
>
> But above causes following error:
>
> ```
> $ make
>   ATS      utf8.dats.c
> /home/kiwamu/src/uemacs-bohai/DATS/utf8.dats: 2179(line=63, offs=30)
> -- 2179(line=63, offs=30): error(3): unsolved constraint:
> C3NSTRprop(C3TKmain(); S2Eapp(S2Ecst(<=); S2Eapp(S2Ecst(+);
> S2EVar(5287->S2Evar(i$3343(8455))),
> S2EVar(5286->S2Evar(n$8684$8685(14342)))),
> S2EVar(5289->S2Evar(m$3344(8456)))))
> typechecking has failed: there are some unsolved constraints: please
> inspect the above reported error message(s) for information.
> exit(ATS): uncaught exception:
>
> _2home_2kiwamu_2src_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
> ```
>
> 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 post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/ats-lang-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ats-lang-users/CAEvX6dkbDJu1TumPn-zwT-50USCPbg25Zhmcqz-05R9jfE8kKQ%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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLrsiEJWgg0FtrZxwZn%3Dfo0gJU90J4hj9Z81Y0%3DenXaewQ%40mail.gmail.com.

Reply via email to