| Summary: | [evaluator] CollectionOclAsTypeOperation needed | ||
|---|---|---|---|
| Product: | [Modeling] OCL | Reporter: | Ed Willink <ed> |
| Component: | Core | Assignee: | OCL Inbox <mdt-ocl-inbox> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.1.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows Vista | ||
| Whiteboard: | |||
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 |
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.]