eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

Closure Inheritance error #102

Closed eclipse-ocl-bot closed 18 hours ago

eclipse-ocl-bot commented 18 hours ago

| --- | --- | | Bugzilla Link | 154695 | | Status | CLOSED INVALID | | Importance | P3 normal | | Reported | Aug 22, 2006 09:26 EDT | | Modified | May 27, 2011 02:48 EDT | | Version | 1.0.0 | | Reporter | Chris Lenz |

Description

ValidationVisitorImpl \ under\ if (opcode == PredefinedType.CLOSURE) {

we can find:\ if (TypeUtil.typeCompare(sourceElementType, iteratorElementType) < 0) {\ -->throw error\ }\ but:\ TypeUtil.typeCompare(sourceElementType, iteratorElementType)"\ returns the following:\ switch (TypeUtil.getRelationship(type1, type2)) {\ case PredefinedType.SAME_TYPE:\ return 0;\ case PredefinedType.STRICT_SUBTYPE:\ return -1;\ case PredefinedType.STRICT_SUPERTYPE:\ return 1;\ so I thing the if statement has to look like\ if (TypeUtil.typeCompare(sourceElementType, iteratorElementType) > 0)

eclipse-ocl-bot commented 18 hours ago

By Chris Lenz on Aug 24, 2006 05:25

Created attachment 48563 Patch

look also to bug 154575, because they have a realtion

:notepad_spiral: patch.txt

eclipse-ocl-bot commented 18 hours ago

By Christian Damus on Sep 07, 2006 17:22

This isn't a bug. In the closure iterator, the results of evaluating the body expression are assigned to the iterator variable recursively. This assignment is only valid if the body expression type conforms to the iterator variable type (which is the element type of the source collection).

The "if" statement indicated below checks that the type of the iterator variable is not a subtype of the body expression type, which would mean that the iterator variable is not assignable from evaluating the body expression.

eclipse-ocl-bot commented 18 hours ago

By Ed Willink on May 27, 2011 02:48

Closing after over 18 months in resolved state.