eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

[classic] Inaccurate selectByKind, selectByType analysis return #1363

Closed eclipse-ocl-bot closed 4 hours ago

eclipse-ocl-bot commented 4 hours ago

| --- | --- | | Bugzilla Link | 439940 | | Status | RESOLVED FIXED | | Importance | P3 normal | | Reported | Jul 19, 2014 12:38 EDT | | Modified | Jul 28, 2014 10:09 EDT | | Reporter | Ed Willink |

Description

In QVTo, selectByKind of a Set cannot be assigned to a Set; the result must be asSet().

Problem seems to be that SELECT_BY_KIND is handled in OCLStandardLibraryUtil.getCollectionTypeResultTypeOf which is the backstop for OCLStandardLibraryUtil.getSequenceTypeResultTypeOf etc.

In contrast SELECT which has the same return type beghaviour is handled in OCLStandardLibraryUtil.getBagTypeResultTypeOf, OCLStandardLibraryUtil.getSequenceTypeResultTypeOf,\ OCLStandardLibraryUtil.getSetTypeResultTypeOf.

Emulating SELECT should fix the problem.

NB OCLStandardLibraryUtil.getOrderedSetTypeResultTypeOf has no SELECT handling. This is easily remedied, but oclstdlib.ecore would need changing too.

So just fix SELECT_BY_KIND/SELECT_BY_TYPE for OrderedSet.

eclipse-ocl-bot commented 4 hours ago

By Ed Willink on Jul 19, 2014 13:13

Fix pushed to branch ewillink/439940.

Please review for SR2

eclipse-ocl-bot commented 4 hours ago

By Adolfo Sanchez-Barbudo Herrera on Jul 28, 2014 08:19

I'm OK with the fix.

Just a question about the "else" logic. I'm not sure about the motivation about it.

if (arg instanceof TypeExp<?>) { ...\ } else {\ argType = arg.getType();\ }

I presume it will never be executed. If it does, any example to figure out ?

Cheers,\ Adolfo.

eclipse-ocl-bot commented 4 hours ago

By Ed Willink on Jul 28, 2014 09:00

(In reply to Adolfo Sanchez-Barbudo Herrera from comment #2)\ Thanks.

Just a question about the "else" logic. I'm not sure about the motivation about it.

if (arg instanceof TypeExp<?>) { ... } else { argType = arg.getType(); }

Copied from OCL_AS_TYPE. In principle

"oclAsType(MyClass)" will have a TypeExp

"oclAsType(if true then MyClass else MyClass endif)" will have an IfExp

You can see the irregularity in org.eclipse.ocl.parser.typeCS

astNode.setReferredType(type);\
astNode.setType(getTypeType(enumLiteralExpCS, env, type));

TypeExp has a conflict as to which metalevel to use as the type. Similar issue in the pivot model arises with Metaclass(T). At Aachen we were called these awkward operation-with-type-arguments typerations.

eclipse-ocl-bot commented 4 hours ago

By Ed Willink on Jul 28, 2014 10:09

Pushed to master for M1, maintenance/5_0 for SR2.