Skip to content

Usage metaclass classification is conflating metaclass with referential/composite syntax signals #709

@groundhog-tech

Description

@groundhog-tech

The current usage-metaclass classification appears to mix up two different dimensions:

usage metaclass / kind (PartUsage, ReferenceUsage, ...)
referential/composite semantics
These are not the same thing.

Per SysML v2 §7.6.4, ReferenceUsage is a usage kind. It is not the generic semantic representation of “referential usage”.

The ref keyword should contribute to referential/composite semantics, not be used as the source of usage metaclass classification.

Minimal example:
package sample {
part a;
part b {
out a;
ref part c;
}
}
Current syster result:
sample::b::a -> PartUsage with direction = out
sample::b::c -> ReferenceUsage

Why this looks wrong
ref part c should not become ReferenceUsage just because ref appears.The ref keyword is a signal for referential/composite semantics, not for deciding whether the usage metaclass is ReferenceUsage.

Expected result:
sample::b::a -> ReferenceUsage with direction = out
sample::b::c -> PartUsage with isReference = true

Likewise, usages without an explicit kind keyword should not simply fall back to PartUsage by default.

Likely cause
The current classification pipeline seems to do exactly that:

base/src/parser/ast/elements.rs
Usage::usage_kind() includes REF_KW => Ref
base/src/parser/ast/mod.rs
token_to_enum_method! scans the whole Usage subtree
base/src/hir/symbols/helpers.rs
UsageKind::Ref -> InternalUsageKind::Reference
None -> InternalUsageKind::Part
So the metaclass classifier is currently consuming syntax that should belong to referential/composite semantics instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions