|View Issue Details [ Jump to Notes ]||[ Issue History ] [ Print ]|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000231||mercury||Bug||public||2011-11-22 16:30||2014-10-09 12:48|
|Target Version||Fixed in Version|
|Summary||0000231: No way to specify instantiatedness of char type|
|Description||There is currently no way to specify the instantiatedness of a char type, e.g.:|
:- inst whitespace ---> ' '; '\t'; '\n'.
The above instantiatednesses are represented as atoms, but since instantiatednesses of character values are internally represented as type char_const(), this leads to mode errors such as:
Final instantiatedness of `HeadVar__1' was `bound('\t' ; '\n' ; ' ')',
expected final instantiatedness was `bound('\t' ; '\n' ; ' ')'.
Attached is a patch which fixes this bug.
|Tags||No tags attached.|
Applying the patch as-is would be unsafe. If you try to switch on the variable following the call to is_whitespace, e.g.
( C = (' '), ...
; C = ('\t'), ...
; C = ('\n'), ...
The inst of C is represented as a list of cons/3 functors and the cases as `char_const' functors. Switch detection does not see them as equivalent so replaces the disjunction by `fail'. I assume other parts of the compiler may have similar problems.
|2011-11-22 16:30||colanderman||New Issue|
|2011-11-22 16:30||colanderman||File Added: char_inst.m|
|2011-11-22 16:31||colanderman||File Added: mercury-compiler-char-inst.patch|
|2014-10-09 12:48||wangp||Note Added: 0000795|