feature-reference-expression-access

Available in: KerML, SysML

This checks that feature references are accessible from the expression scope, and catches mistakes of accessing features of unrelated types.

Example

part a {
    part b {
        part c {
            part d;
        }
    }
    part = b::c; // error: Feature reference must be accessible from the outer scope, did you mean to use chain notation?
    part = b::c.d; // error: Feature reference must be accessible from the outer scope, did you mean to use chain notation?
}
part = a::b.c; // error: Feature reference must be accessible from the outer scope, did you mean to use chain notation?
part = a::b.c.d; // error: Feature reference must be accessible from the outer scope, did you mean to use chain notation?
part = a::b::c; // error: Feature reference must be accessible from the outer scope, did you mean to use chain notation?

Fix this by using chain notation:

part a {
    part b {
        part c {
            part d;
        }
    }
    part = b.c; // ok
    part = b.c.d; // ok
}
part = a.b.c; // ok
part = a.b.c.d; // ok
part = a.b.c; // ok

Options

  • lint.feature-reference-expression-access

    Allows controlling the diagnostic severity, e.g. off to disable it.


All validation rules