Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344931 - [evaluator] CollectionOclAsTypeOperation needed
Summary: [evaluator] CollectionOclAsTypeOperation needed
Status: CLOSED INVALID
Alias: None
Product: OCL
Classification: Modeling
Component: Core (show other bugs)
Version: 3.1.0   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: OCL Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-06 04:57 EDT by Ed Willink CLA
Modified: 2014-05-27 09:52 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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