Community
Participate
Working Groups
oclAsType must be overloaded for collections to support deep conformance in order to get the following tests to pass. assertQueryResults(null, "Set{1,2}", "Set{1.0,2}->oclAsType(Collection<UnlimitedNatural>)"); assertQueryResults(null, "Set{1,2}", "Set{1.0,2.0}->oclAsType(Collection<UnlimitedNatural>)"); [Numerics are just a convenient test vehicle; applies to any conformance down cast.]
Under the simpler treatment of oclAsType as a type rename rather than a type conversion the examples are clearly invalid. 1.0 cannot be cast to UnlimitedNatural, without using round().
The Integer to UnlimitedNatural cast is a different issue. Set<Integer> can be downcast to Set<UnlimitedNatural> provided all the elements are themselves castable to UnlimitedNatural.
The following sub-test demonstrates that deep conformance works where appropriate: assertQueryResults(null, "Set{Set{1,2},Set{3,4}}", "Set{Set{1,2},Set{3,4}}->oclAsType(Set(Set(Integer)))"); downcasting is not supported.
CLOSED after more than a year in RESOLVED state.
and CLOSE