Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ST6RI-767: Some redefinitions are not correctly rendered (PlantUML) #561

Merged
merged 4 commits into from
Apr 22, 2024

Conversation

himi
Copy link
Member

@himi himi commented Apr 19, 2024

The changes in PR #558 introduced a bug so that a redefinition whose target is missing may not be correctly rendered. For example,

part p1 {
  part p11;
}
part p2 :> p1 {
  part p21 :>> p11;
}

and %viz --view interconnection p2::p21 renders
image
So far, redefinitions are handled with inherit key of redefined features, but that does not work well in some cases such as the above. This PR enhances PC (PathContext) to properly handle redefinitions by differentiating the equivalence classes of redefinitions and non-redefinitions. By this enhancement, we can use the same inherit key with non-redefinition cases.

  matchElement().
* VDefault (addSpecializations): Just make an InheritKey from typ (do
  not anything special here).
* VPath (PC): Make it get aware of noRedefine.
(PCFeatureChainExpression, PCItemFlowEnd): Set noRedefine to always
false.
(PCFeature, PCFeatureChain): Take noRedefine argument.
(PCInheritKey): Just use the original noRedefine.
(makeFeaturePC): Take noRedefine isRedefinition argument.
(addContextForFeature): Take isRedefinition argument, and use
makeInheritKeyForReferer() as well.
(caseType): Set isRedefinition to true if sp is Redefinition.
  FeatureUtil.getAllRedefinedFeaturesOf().
  (traverseRest): Check features with markRedefining().
@himi
Copy link
Member Author

himi commented Apr 19, 2024

I checked this PR with many test cases. For example,

    package Case1 {
        part p1 {
            attribute a11;
        }
        part p2 :> p1 {
            attribute a21 :>> a11 {
                /* comment */
            }
        }
    }
    package Case2 {
        part p1 {
            attribute a11;
        }
        part p2 {
            attribute a21 :>> p1.a11 {
                /* comment */
            }
        }
    }
    package Case3 {
        part p1 {
            attribute a11;
        }
        part p2 :> p1 {
            attribute a21 :>> p1.a11 {
            	/* comment */
            }
            attribute a22 = p1.a11;
        }
    }

The result in interconnection view looks like:
Screenshot 2024-04-19 at 12 59 43 AM

@himi
Copy link
Member Author

himi commented Apr 19, 2024

Even if we visualize, for example, Case1::p2::a21 only (the comment is for this purpose in Eclipse), we get:
Screenshot 2024-04-19 at 1 01 46 AM
This does not render a spurious redefinition.

@himi
Copy link
Member Author

himi commented Apr 19, 2024

This PR also uses FeatureUtil.getAllRedefinedFeaturesOf() instead of iterating redefined features. It is important to deal with implicit elements. Therefore, we can properly handle

package TestRedefinedFeatures {
    action a0 {
        action a01 {
            out output;
        }
        flow f1 from a01.output to a02.input;
        action a02 {
            in input;
        }
    }

    action a1 :> a0 {
        action :>> a02 {
        	in input;
        }
    }
}

The rendered result is:

Screenshot 2024-04-19 at 1 05 53 AM

Previously, we had to explicitly redefine a1.a02.input to correctly render it.

@himi himi requested a review from seidewitz April 19, 2024 05:07
@seidewitz seidewitz self-assigned this Apr 21, 2024
@seidewitz seidewitz added this to the 2024-04 milestone Apr 21, 2024
Copy link
Member

@seidewitz seidewitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this both in Eclipse and Jupyter. Looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants