Closed nickbattle closed 3 years ago
The issue can be resolved by treating map applies (and sequence applies) the same way as function applies, where the argument is converted to the parameter type (ie. the domain type of the map, or nat1 for sequences) before the evaluation proceeds. In this case, the raw <Hourly>
is converted to a Beat type before searching for it in the TreeMap. This then works as expected.
It's interesting to note that this approach is already taken in assignment statements that lookup a map/sequence designator. So I suspect that an equivalent to this problem has already been found in an assignment context.
Fix now available in ncb/development.
The following spec fails in 3.0.2:
The lookup of
<Hourly>
fails, even though it is clearly in the domain of the map. The problem is that the value in the map is aBeat
value, which has an order clause. That is used to store the range value in a particular branch of a Java TreeMap (which backs the VDM map). But the argument passed to the map apply is a literal<Hourly>
, which is a raw quote type. This is not ordered (it has a default ordering, based on the toString), and hence Java searches a different part of the TreeMap, and fails to find the key.