Skip to content

AST for SuccessionAsUsage element whitout the "first" part seems incorrect #13

Open
@adaussy

Description

@adaussy

Checklist before submitting a bug report

  • I have reviewed CONTRIBUTING.md document
  • I have done a quick search on the issue tracker to check if the bug report is not redundant

Context

I'm analyzing the AST of a simple use case:

action def ActionDef1 {
    action a2;
    action a1;
    then a2; // Equivalent of first a1 then a2;
}

Steps to reproduce the bug

Import that example and dump the AST using SysIDE

Current result

I'm surprise by produced AST for the SuccessionAsUsage:

{
    "$type": "SuccessionAsUsage",
    "ends": [
      {
        "$type": "EndFeatureMembership",
        "$cstNode": {
          "text": "then a2",
          "stack": [
            "TargetSuccession",
            "ActionTargetSuccession"
          ]
        },
        "isAlias": false,
        "elements": [],
        "target": {
          "$type": "Feature",  // <- Here is the strange structure
          "$cstNode": {
            "text": "then a2",
            "stack": [
              "TargetSuccession",
              "ActionTargetSuccession"
            ]
          },
          "isNonunique": false,
          "isOrdered": false,
          "heritage": [],
          "isSufficient": false,
          "typeRelationships": [],
          "children": [],
          "prefixes": [],
          "$meta": {
            "elementId": 540595,
            "qualifiedName": ""
          }
        },
        "$meta": {
          "elementId": 540594,
          "qualifiedName": ""
        }
      },
      {
        "$type": "EndFeatureMembership",
        "target": {
          "$type": "ReferenceUsage",
          "heritage": [
            {
              "$type": "ReferenceSubsetting",
              "targetRef": {
                "$type": "FeatureReference",
                "$cstNode": {
                  "text": "a2",
                  "stack": [
                    "FeatureReference",
                    "OwnedReferenceSubsetting"
                  ]
                },
                "text": "a2",
                "reference": "ActionDef1::a2",
                "parts": [
                  "ActionDef1::a2"
                ]
              },
              "$cstNode": {
                "text": "a2",
                "stack": [
                  "OwnedReferenceSubsetting",
                  "ConnectorEnd"
                ]
              },
              "elements": [],
              "$meta": {
                "elementId": 540598,
                "qualifiedName": ""
              }
            }
          ],
          "$cstNode": {
            "text": "a2",
            "stack": [
              "ConnectorEnd",
              "ConnectorEndMember"
            ]
          },
          "isIndividual": false,
          "isReference": false,
          "isVariation": false,
          "isNonunique": false,
          "isOrdered": false,
          "isSufficient": false,
          "typeRelationships": [],
          "children": [],
          "prefixes": [],
          "$meta": {
            "elementId": 540597,
            "qualifiedName": ""
          }
        },
        "$cstNode": {
          "text": "a2",
          "stack": [
            "ConnectorEndMember",
            "TargetSuccession"
          ]
        },
        "isAlias": false,
        "elements": [],
        "$meta": {
          "elementId": 540596,
          "qualifiedName": ""
        }
      }
    ],
    "$cstNode": {
      "text": "then a2;",
      "stack": [
        "ActionTargetSuccession",
        "TargetSuccessionMember"
      ]
    },
    "elements": [],
    "isIndividual": false,
    "isReference": false,
    "isVariation": false,
    "isNonunique": false,
    "isOrdered": false,
    "heritage": [],
    "isSufficient": false,
    "typeRelationships": [],
    "children": [],
    "prefixes": [],
    "$meta": {
      "elementId": 540593,
      "qualifiedName": ""
    }
  }

Expected result

The first EndFeatureMembership contains a Feature whereas the second contains what seems to me a the correct structure for ReferenceUsage/ReferenceSubsetting that reference "ActionDef1::a2".

I would have expected the first EndFeatureMembership to have the same structure ReferenceUsage/ReferenceSubsetting without the resolved reference to the feature since in that case the target is implicit (previous feature of the owningNamespace of the SucessionUsage).

Possible fix

Make the AST produce the same structure for the first and second `EndFeatureMembership (without reference resolution for the first one).

Technical data

  • Operating system: Windows
  • Version of the repo: 0.8.0
  • VSCode version: 1.97.

/label ~"bug report"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions