Skip to content

Comments

ST6RI-891 Feature chain name resolution allows protected names#709

Merged
seidewitz merged 2 commits intomasterfrom
ST6RI-891
Nov 5, 2025
Merged

ST6RI-891 Feature chain name resolution allows protected names#709
seidewitz merged 2 commits intomasterfrom
ST6RI-891

Conversation

@seidewitz
Copy link
Member

This PR resolves a bug in the resolution of names that appear to the right of the dot (.) in feature chain and related notations.

Background

Consider the following:

part p {
    public attribute a;
    protected attribute b;
    private attribute c;
}

alias a1 for p::a; // No error
alias b1 for p::b; // Name resolution error
alias c1 for p::c; // Name resolution error

attribute a2 redefines p.a; // No error
attribute b2 redefines p.b; // Previously no error
attribute b3 redefines p.c; // Name resolution error

As shown above, both protected and private members are not visible outside of their namespace (except that protected members are inherited by specialize types). Previously, protected members (but not private members) were visible in feature chains. This was also the case for feature chaining expressions and the left-hand side target of an assignment action.

Code changes

This PR makes a small update to KerMLScope that fixes the above anomaly. Visibility rules are now implemented the same for feature chains (and feature chaining expressions and assignment targets) as for segments of a qualified names.

Tests fail because protected names are being allow when resolving names
to the left of a dot (".").
In initial scope, protected members are resolved only if isInsideScope.
@seidewitz seidewitz added this to the 2025-10 milestone Oct 29, 2025
@seidewitz seidewitz self-assigned this Oct 29, 2025
@seidewitz seidewitz merged commit f99ad61 into master Nov 5, 2025
2 checks passed
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