namespace-distinguishability

Available in: KerML, SysML

This checks that namespace member names are unambiguous.

Note that this does not yet check imported memberships, and only checks that owned members are not ambiguous with inherited members, that is inherited names are not checked across specializations.

Specification

All memberships of a Namespace must be distinguishable from each other.

Example

Owned members:

package A;
package <A>; // error: Member name 'A' shadows A

Inherited members:

part def A { attribute a; }
part def B :> A { attribute  a; } // error: Member name 'a' shadows A::a

Aliases:

part def A { attribute a; }
part def B :> A { alias a for A; } // error: Member name 'a' shadows A::a

Multiple inheritance:

part def A { attribute a; }
part def B { attribute a; }
part def C :> A, B { attribute a :>> A::a; } // error: Member name 'a' shadows B::a

There is no general fix, although multiple inheritance case can be fixed by redefining all ambiguous inherited members:

part def A { attribute a; }
part def B { attribute a; }
part def C :> A, B { attribute a :>> A::a, B::a; } // ok