Legacy Issue Number: 18504
Source: Universidad Nacional del Litoral ( Roberto Javier Godoy)
Section 188.8.131.52 states that "there must be at least one element fulfilling body, otherwise the result of this IteratorExp is null." And defines
source->any(iterator|body) = source->select(iterator | body)
>From section 11.7.5
context Sequence::first() : T
post: result = self->at(1)
context Sequence::at(i : Integer) : T
pre : i >= 1 and i <= self->size()
If there is no element fulfilling body, then seq is empty and the precondition of Sequence::at does not hold because 1 > seq->size().
Related to: Issue 18125 [OCL 2.4]
Reported: OCL 2.3.1 — Tue, 26 Feb 2013 05:00 GMT
Disposition: Resolved — OCL 2.4
The 'equivalent' OCL of
source->select(iterator | body)
returns invalid if no elements are selected, rather than null as the words say.
As identified in Issue 18125, null could also be a valid value, so the words are clearly wrong.
Updated: Fri, 6 Mar 2015 20:57 GMT