Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 344931

Summary: [evaluator] CollectionOclAsTypeOperation needed
Product: [Modeling] OCL Reporter: Ed Willink <ed>
Component: CoreAssignee: 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:

Description Ed Willink CLA 2011-05-06 04:57:33 EDT
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.]
Comment 1 Ed Willink CLA 2011-09-13 01:34:45 EDT
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().
Comment 2 Ed Willink CLA 2012-01-09 04:32:26 EST
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.
Comment 3 Ed Willink CLA 2013-03-16 04:17:18 EDT
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.
Comment 4 Ed Willink CLA 2014-05-27 09:44:22 EDT
CLOSED after more than a year in RESOLVED state.
Comment 5 Ed Willink CLA 2014-05-27 09:52:45 EDT
and CLOSE