Skip to content

Commit b9f3d81

Browse files
committed
ST6RI-864 Updated handling of result typing for IndexExpressions.
- Fixed if test to correctly check specialization by seqResult. - Generalized if test so that result typing is added for any seqResult that does not have a Collection type.
1 parent 627e8dc commit b9f3d81

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

org.omg.sysml/src/org/omg/sysml/adapter/IndexExpressionAdapter.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232

3333
public class IndexExpressionAdapter extends OperatorExpressionAdapter {
3434

35-
public static final String ARRAY_TYPE = "Collections::Array";
36-
public static final String SCALAR_VALUE_TYPE = "ScalarValues::ScalarValue";
35+
public static final String COLLECTIONS_TYPE = "Collections::Collection";
3736

3837
public IndexExpressionAdapter(IndexExpression element) {
3938
super(element);
@@ -55,16 +54,14 @@ protected void addResultTyping() {
5554
Expression seqArgument = arguments.get(0);
5655
ElementUtil.transform(seqArgument);
5756
Feature seqResult = seqArgument.getResult();
58-
Type arrayType = getLibraryType(ARRAY_TYPE);
59-
Type scalarValueType = getLibraryType(SCALAR_VALUE_TYPE);
57+
Type collectionType = getLibraryType(COLLECTIONS_TYPE);
6058
/*
6159
* TODO: Update checkIndexExpressionResultSpecialization
62-
* See KERML11-69.
63-
*
64-
* TODO: Generalize to handle all types other than Collection types?
65-
* TODO: Replace target with seqResult in specialization checks.
66-
*/
67-
if (!TypeUtil.specializes(target, arrayType) || TypeUtil.specializes(target, scalarValueType)) {
60+
*
61+
* OCL currently only checks for Array type, not any Collection type.
62+
* See KERML11-69
63+
*/
64+
if (!TypeUtil.specializes(seqResult, collectionType)) {
6865
Feature resultFeature = target.getResult();
6966
if (resultFeature != null && seqResult != null) {
7067
TypeUtil.addImplicitGeneralTypeTo(resultFeature, SysMLPackage.eINSTANCE.getSubsetting(), seqResult);

0 commit comments

Comments
 (0)