View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0000001 | mercury | Bug | public | 2007-09-17 11:18 | 2007-09-25 11:54 | ||||||||
Reporter | obo | ||||||||||||
Assigned To | |||||||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||||||
Status | acknowledged | Resolution | open | ||||||||||
Product Version | |||||||||||||
Target Version | Fixed in Version | ||||||||||||
Summary | 0000001: non-instructive error message: 'unused' mode requires explicit lambda expression | ||||||||||||
Description | Hi. the attached code demonstrates a not quite instructive error message. While the predicate main2/2 compiles fine, main/2 does not, because I try to directly pass/curry an argument in 'unused' mode. One solution is to automatically infer the correct mode when currying, another is to make the error message more specific. Thanks, O. | ||||||||||||
Additional Information | bug.m:019: In clause for `main(in, out)': bug.m:019: in argument 1 of call to predicate `call_int_modifier'/3: bug.m:019: mode error: variable `V_7' has instantiatedness `free', bug.m:019: expected instantiatedness for non-local variables of lambda goals bug.m:019: is `ground'. | ||||||||||||
Tags | No tags attached. | ||||||||||||
Attached Files |
|
Notes | |
obo (reporter) 2007-09-17 11:56 |
Oh, in fact, changing main2 to something more useful -- i.e. passing the 'unused' value from outside (to pass type information) is prohibited for the same reasons: non-local vars ought to have ground inst. :- pred main2(mytype::unused, int::in, int::out) is det. main2(X, In, Out) :- call_int_modifier( (pred(I::in, O::out) is det :- add(X, I, O)), In, Out). I'm failing to work around it using (ground) type_desc: :- import_module type_desc. :- pred main3(mytype::unused, int::in, int::out) is det. main3(X, In, Out) :- XType = type_of(X), call_int_modifier( (pred(I::in, O::out) is det :- has_type(NewX, XType), add(NewX, I, O)), In, Out). bug.m:037: In clause for predicate `main3'/3: bug.m:037: in argument 1 of call to predicate `add'/3: bug.m:037: type error: variable `NewX' has type `(some [T] T)', bug.m:037: expected type was `(bug2.mytype)'. Is there a way to construct a free variable with a specific type? My guess is that this is the core restriction of the current mode checker... |
juliensf (administrator) 2007-09-25 11:54 |
We will take a look at it. |