conjure-cp / conjure

Conjure: The Automated Constraint Modelling Tool
Other
94 stars 20 forks source link

unexpected "undefined reference" #576

Open ott2 opened 1 year ago

ott2 commented 1 year ago

The following simple spec

given vertices new type enum
find move : function (total) int(1..1) --> tuple(vertices,vertices)
such that
   move(1) = (min(vertices),min(vertices))

works great with conjure solve tmp.essence tmp.param and this parameter file:

letting vertices be new type enum {loc_1_1,loc_2_1}

However, with the same parameter file the following spec (which I would expect to behave identically)

given vertices new type enum
find move : function (total) int(1..1) --> tuple(vertices,vertices)
letting Z be min(vertices)
such that
   move(1) = (Z,Z)

fails with

Error:
    Undefined reference: vertices
    Bindings in context:
        move: declaration of find move: function (total) int(1) --> (vertices, vertices)

This is with current head, but an equivalent error is printed by conjure 2019-11-19.

This looks to me as if the symbol table entry representing min(vertices) is getting messed up, almost as if the letting has stomped over the previous entry. However, this is pure speculation and not informed by the code.

If there is a reason this should not work, then an error message mentioning the letting Z... line would probably be helpful, rather than blaming vertices, the definition of which hasn't changed.