[Ur] postBody compiler bug

Sergey Mironov grrwlf at gmail.com
Wed Aug 6 09:05:00 EDT 2014


Hi. I've stepped at a bug. I'm not sure it is postBody-related, I name
it so because I have to name it somehow. Here is the program (see also
here [1]):

fun api_1 (pb:postBody) (nm:string) : transaction page =
  return <xml>Processing the request</xml>

fun api (pb:postBody) (v:int) (nm:string) : transaction page =
  case v of
    |1 => api_1 pb nm
    |_ => error <xml>Version {[v]} is not supported</xml>


And here is the error message:

dev:[grwlf at ww:~/proj/urbugs]$ LANG=C urweb PostBody
gcc  -pthread -Wimplicit -Werror -Wno-unused-value -I
/home/grwlf/local/include/urweb  -c /tmp/webapp.c -o /tmp/webapp.o -g
/tmp/webapp.c: In function '__uwn_wrap_api_1489':
/tmp/webapp.c:144:109: error: passing argument 2 of
'uw_Basis_htmlifyInt' makes integer from pointer without a cast
[-Werror]

                                      __uwr_x2_2);

                                      ^
In file included from /home/grwlf/local/include/urweb/urweb.h:5:0,
                 from /tmp/webapp.c:8:
/home/grwlf/local/include/urweb/urweb_cpp.h:94:7: note: expected
'uw_Basis_int' but argument is of type 'uw_Basis_string'
 char *uw_Basis_htmlifyInt(struct uw_context *, uw_Basis_int);
       ^
cc1: all warnings being treated as errors

Note that the error will gone if I remove {[v]} from the error message

Regards,
Sergey

[1] - git clone https://github.com/grwlf/urbugs && cd urbugs && urweb PostBody



More information about the Ur mailing list