passes

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// CodeControlNodeIncomingMultiplicity: a succession into a control node
	// writes a target multiplicity other than 1..1
	// (validateControlNodeIncomingSuccessions).
	CodeControlNodeIncomingMultiplicity = "control-node-incoming-multiplicity"
	// CodeControlNodeOutgoingMultiplicity: a succession out of a control node
	// writes a source multiplicity other than 1..1
	// (validateControlNodeOutgoingSuccessions).
	CodeControlNodeOutgoingMultiplicity = "control-node-outgoing-multiplicity"
	// CodeForkIncomingSuccessions: a fork node has more than one incoming
	// succession (validateForkNodeIncomingSuccessions).
	CodeForkIncomingSuccessions = "fork-incoming-successions"
	// CodeJoinOutgoingSuccessions: a join node has more than one outgoing
	// succession (validateJoinNodeOutgoingSuccessions).
	CodeJoinOutgoingSuccessions = "join-outgoing-successions"
	// CodeMergeIncomingMultiplicity: a succession into a merge node writes a
	// source multiplicity other than 0..1 (validateMergeNodeIncomingSuccessions).
	CodeMergeIncomingMultiplicity = "merge-incoming-multiplicity"
	// CodeMergeOutgoingSuccessions: a merge node has more than one outgoing
	// succession (validateMergeNodeOutgoingSuccessions).
	CodeMergeOutgoingSuccessions = "merge-outgoing-successions"
	// CodeDecisionIncomingSuccessions: a decision node has more than one
	// incoming succession (validateDecisionNodeIncomingSuccessions).
	CodeDecisionIncomingSuccessions = "decision-incoming-successions"
	// CodeDecisionOutgoingMultiplicity: a succession out of a decision node
	// writes a target multiplicity other than 0..1
	// (validateDecisionNodeOutgoingSuccessions).
	CodeDecisionOutgoingMultiplicity = "decision-outgoing-multiplicity"
)

Diagnostic codes for the bounds SysML v2 8.3.17 places on the successions of each control-node kind, one per validation constraint.

View Source
const (
	CodeOOSEMRequirementNotDerived   = "oosem-requirement-not-derived"
	CodeOOSEMRequirementNotSatisfied = "oosem-requirement-not-satisfied"
	CodeOOSEMLogicalNotAllocated     = "oosem-logical-component-not-allocated"
	CodeOOSEMUseCaseSubject          = "oosem-use-case-subject"
)

Diagnostic codes of the OOSEM method rules.

View Source
const (
	CodeSendPayloadMissing        = "send-payload-missing"
	CodeSendToPort                = "send-to-port"
	CodeSendReceiverNotOccurrence = "send-receiver-not-occurrence"
	CodeSendSenderNotOccurrence   = "send-sender-not-occurrence"
)

Diagnostic codes of the send-action rules.

View Source
const CodeAccepterSourceNotState = "accepter-source-not-state"

CodeAccepterSourceNotState marks a transition whose accepter waits in something other than a state (SysML v2 §7.16 TransitionUsage).

View Source
const CodeConnectorEnds = "connector-ends"

CodeConnectorEnds marks a connector whose ends do not fit the link it specializes: too many for a binary link, or redefining no end of it.

View Source
const CodeControlNodeOwner = "control-node-owner"

CodeControlNodeOwner marks a control node declared outside an action definition or usage (SysML v2 8.3.17.6 validateControlNodeOwningType).

View Source
const CodeEndpointNotANode = "endpoint-not-a-node"

CodeEndpointNotANode marks an action endpoint naming something other than an action node accepted by the action lowerer.

View Source
const CodeEndpointNotOfMachine = "endpoint-not-of-machine"

CodeEndpointNotOfMachine marks a transition endpoint naming a vertex the machine the transition belongs to does not own (UML 2.5.1 §14.2.3.9).

View Source
const CodeEntryTransitionShape = "entry-transition-shape"

CodeEntryTransitionShape marks a transition out of the entry action written with a trigger or an effect, which chooses a starting state by its guard alone (SysML v2 §7.18.3, EntryTransitionMember).

View Source
const CodeEntryTransitionTarget = "entry-transition-target"

CodeEntryTransitionTarget marks a transition out of the entry action whose target is a vertex but not a state the body can start in (SysML v2 §7.18.3).

View Source
const CodeKerMLNotation = "kerml-notation"

CodeKerMLNotation marks KerML notation used in a SysML file, where the SysML grammar has no production for it. Strict mode rejects it too: the pinned SysML grammar admits it nowhere.

View Source
const CodeNoOutgoingTransition = "no-outgoing-transition"

CodeNoOutgoingTransition marks a routing pseudostate no transition leaves, which a transition reaching it terminates nowhere at (UML 2.5.1 §15.7.18).

View Source
const CodeNoTransitionSource = "no-transition-source"

CodeNoTransitionSource marks a transition written without a source that no member precedes in its body (SysML v2 §7.18.3, TargetTransitionUsage).

View Source
const CodeNonstandardNotation = "nonstandard-notation"

CodeNonstandardNotation marks notation OpenSysML accepts that no production of the pinned SysML v2 grammars admits.

View Source
const CodeParallelStateTransition = "parallel-state-transition"

CodeParallelStateTransition marks a succession or transition ordering the direct substates of a parallel state, which are concurrent (SysML v2 §7.16).

View Source
const CodeReservedKeywordName = "reserved-keyword-name"

CodeReservedKeywordName marks a recovered declared name spelled as a reserved keyword, which analysis rejects in every mode.

View Source
const CodeSysMLNotation = "sysml-notation"

CodeSysMLNotation marks SysML notation used in a KerML file, which the pinned KerML grammar admits nowhere.

View Source
const CodeTransitionSourceNotVertex = "transition-source-not-vertex"

CodeTransitionSourceNotVertex marks a transition written without a source whose preceding member is not a vertex of the machine (SysML v2 §7.18.3).

View Source
const CodeUnboundParameter = "unbound-parameter"

CodeUnboundParameter advises of an invocation leaving a default-less input parameter unbound: well formed (KerML 1.0 §8.3.4.8.8), but the runtime refuses to evaluate it.

Variables

This section is empty.

Functions

func ChainCallee added in v0.7.0

func ChainCallee(e *ast.InvocationExpr) *ast.FeatureChainExpr

ChainCallee is the feature chain a call `x.f(a)` applies (KerMLExpressions InstantiatedTypeMember → OwnedFeatureChain), nil for `T(a)` and `x->T(a)`.

func InvocationArgs added in v0.7.0

func InvocationArgs(e *ast.InvocationExpr) []ast.Node

InvocationArgs returns e's positional arguments, the receiver of `x->f(a)` first; the operand of a chain call `x.f(a)` is the calc applied, not an argument.

func NewArgumentTyper added in v0.5.0

func NewArgumentTyper(resolver *resolve.Resolver, model *semantics.Model) semantics.ArgumentTyper

NewArgumentTyper is the checker's argument typing for model to select calls with, so a consumer reading a call through the model selects what the checker selects.

func SelectInvocation added in v0.5.0

func SelectInvocation(resolver *resolve.Resolver, model *semantics.Model, scope *symbols.Scope, e *ast.InvocationExpr, performs semantics.Performs) *semantics.InvocationSelection

SelectInvocation is the declaration e calls in scope, chosen among every visible declaration of its name the call site can run by its arguments' static types; the runtime dispatches on it too.

Types

type ActionEndpointPass added in v0.3.0

type ActionEndpointPass struct{}

ActionEndpointPass checks endpoints written in action bodies against the nodes accepted by action lowering.

func (ActionEndpointPass) ElementScoped added in v0.3.0

func (ActionEndpointPass) ElementScoped()

ElementScoped lets each endpoint subject gate independently on lower failures.

func (ActionEndpointPass) Level added in v0.3.0

func (ActionEndpointPass) Level() PassLevel

Level reports that this pass consumes name-resolution results.

func (ActionEndpointPass) Run added in v0.3.0

func (ActionEndpointPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

Run checks named endpoints in every action body in the document.

type AnnotationOwnershipPass added in v0.6.0

type AnnotationOwnershipPass struct{}

AnnotationOwnershipPass checks that an annotation owned by its annotated element owns its annotating element (KerML 8.3.2.3.3): textually, no `about` names itself.

func (AnnotationOwnershipPass) ElementScoped added in v0.6.0

func (AnnotationOwnershipPass) ElementScoped()

ElementScoped: each `about` reference gates on its own resolution.

func (AnnotationOwnershipPass) Level added in v0.6.0

func (AnnotationOwnershipPass) Run added in v0.6.0

type AssignmentReferentPass added in v0.2.0

type AssignmentReferentPass struct{}

AssignmentReferentPass checks SysML AssignmentActionUsage referents.

func (AssignmentReferentPass) ElementScoped added in v0.2.0

func (AssignmentReferentPass) ElementScoped()

func (AssignmentReferentPass) Level added in v0.2.0

func (AssignmentReferentPass) Run added in v0.2.0

type AssociationEndTypesPass added in v0.2.0

type AssociationEndTypesPass struct{}

AssociationEndTypesPass checks that every owned end feature of an association has exactly one type (KerML 8.3.4.1.2, validateAssociationEndTypes), counting types inherited by redefinition and ignoring ones a more specific type implies.

func (AssociationEndTypesPass) Level added in v0.2.0

func (AssociationEndTypesPass) Run added in v0.2.0

type ConstraintPass

type ConstraintPass struct{}

ConstraintPass runs the depth-C semantic constraint checks over a document's symbol tree: specialization-cycle detection, multiplicity-range validity, and subsetting multiplicity conformance (design §4.1). It runs at LevelConstraint, after type checking; it relies on the shared semantic model for the resolved specialization graph and extracted multiplicities.

func (ConstraintPass) Level

func (ConstraintPass) Level() PassLevel

func (ConstraintPass) Run

func (ConstraintPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type Context

type Context struct {
	Name             string
	Kind             source.Kind
	Index            *symbols.Index
	ParseDiagnostics []Diagnostic
	// Options is what the caller asked for, fixed at construction: a pass reads
	// it, and nothing mutates it during a run.
	Options Options
	// contains filtered or unexported fields
}

Context carries shared state made available to every pass in a run: the document name, the global symbol index, a lazily-created shared resolver, and the syntax diagnostics produced by the caller's parse (passes must not import the parser, so these enter here).

func NewContext

func NewContext(name string, idx *symbols.Index, parseDiags []Diagnostic) *Context

NewContext builds a Context for a document, in the default mode.

func NewContextWithKind added in v0.2.0

func NewContextWithKind(name string, kind source.Kind, idx *symbols.Index,
	parseDiags []Diagnostic) *Context

NewContextWithKind builds a context with an explicit source language.

func NewContextWithOptions added in v0.2.0

func NewContextWithOptions(name string, kind source.Kind, idx *symbols.Index,
	parseDiags []Diagnostic, opts Options) *Context

NewContextWithOptions builds a context that carries explicit analysis options.

func (*Context) DownstreamOfFailure added in v0.2.0

func (c *Context) DownstreamOfFailure(ref ast.Node) bool

DownstreamOfFailure reports whether a reference an element's meaning rests on — its type, its metaclass — carries a blocking fault from a lower tier, so a pass whose subject is that element has nothing sound to judge.

func (*Context) Model

func (c *Context) Model() *semantics.Model

Model returns the shared semantic model (specialization graph, multiplicity, inherited members, evaluator) for this context, creating it on first use over the shared resolver so constraint passes reuse one memoized instance.

func (*Context) Resolver

func (c *Context) Resolver() *resolve.Resolver

Resolver returns the shared resolver for this context, creating it on first use so multiple passes reuse one memoized instance.

type ControlNodeSuccessionPass added in v0.5.0

type ControlNodeSuccessionPass struct{}

ControlNodeSuccessionPass checks the successions of fork, join, merge, and decision nodes against the bounds SysML v2 7.17.3 places on each kind, and that every control node is owned by an action definition or usage.

func (ControlNodeSuccessionPass) ElementScoped added in v0.5.0

func (ControlNodeSuccessionPass) ElementScoped()

ElementScoped: each control node is its own subject.

func (ControlNodeSuccessionPass) Level added in v0.5.0

func (ControlNodeSuccessionPass) Run added in v0.5.0

type Diagnostic

type Diagnostic struct {
	Severity Severity
	Span     source.Span
	Message  string
	Code     string // stable identifier for filtering / quick-fix selection
	Source   string // the pass ID that produced this diagnostic
	// Fixes are the unambiguous edits resolving the diagnostic, offered by an
	// editor as quick fixes.
	Fixes []quickfix.Fix
	// Notation marks a finding about how the model is written rather than about
	// what it means: the document still reads, so it does not gate higher tiers.
	Notation bool
}

Diagnostic is a single validation finding produced by a pass.

func Analyze

func Analyze(name string, root *ast.RootNamespace, parseDiags []Diagnostic, idx *symbols.Index) []Diagnostic

Analyze runs the default validation passes over a single parsed document and returns diagnostics sorted by span offset, then source, then message. parseDiags are the parser's diagnostics, already adapted to passes.Diagnostic by the caller.

func AnalyzeWithKind added in v0.2.0

func AnalyzeWithKind(name string, kind source.Kind, root *ast.RootNamespace,
	parseDiags []Diagnostic, idx *symbols.Index) []Diagnostic

AnalyzeWithKind validates a document whose language is not encoded in name, in the default conformance mode.

func AnalyzeWithOptions added in v0.2.0

func AnalyzeWithOptions(name string, kind source.Kind, root *ast.RootNamespace,
	parseDiags []Diagnostic, idx *symbols.Index, opts Options) []Diagnostic

AnalyzeWithOptions validates a document under explicit analysis options.

func (Diagnostic) Blocking added in v0.2.0

func (d Diagnostic) Blocking() bool

Blocking reports whether the finding stops what depends on the model being readable — a higher validation tier, a summary of what a submission declared. A notation error is about the writing, not the meaning, so it stops neither.

type DocumentPlanPass added in v0.4.2

type DocumentPlanPass struct{}

DocumentPlanPass validates native document definitions.

func (DocumentPlanPass) ElementScoped added in v0.4.2

func (DocumentPlanPass) ElementScoped()

func (DocumentPlanPass) Level added in v0.4.2

func (DocumentPlanPass) Level() PassLevel

func (DocumentPlanPass) Run added in v0.4.2

func (DocumentPlanPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type DocumentQueryPass added in v0.4.1

type DocumentQueryPass struct{}

DocumentQueryPass validates native document-query definitions.

func (DocumentQueryPass) ElementScoped added in v0.4.1

func (DocumentQueryPass) ElementScoped()

func (DocumentQueryPass) Level added in v0.4.1

func (DocumentQueryPass) Level() PassLevel

func (DocumentQueryPass) Run added in v0.4.1

func (DocumentQueryPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type ElementFilterPass

type ElementFilterPass struct{}

ElementFilterPass checks the element-filter conditions a document writes: the `filter` members of a namespace (KerML 8.2.4) and the `[...]` clause of an import or expose (SysML v2 7.4.4). A condition is a predicate over one candidate element, so it has to be boolean-valued and it has to be a form the filter evaluator can decide; a condition that is neither selects nothing, and name resolution keeps every candidate rather than hiding model content on a verdict it could not reach.

It runs at LevelType, and its subject is one condition. A classification test is Boolean whatever type it names, so it rests on that type and says nothing more once the type fails to resolve; every other form is judged on itself, where an unresolved name is the verdict — not model-level evaluable — rather than a reason to withhold it.

func (ElementFilterPass) ElementScoped added in v0.2.0

func (ElementFilterPass) ElementScoped()

func (ElementFilterPass) Level

func (ElementFilterPass) Level() PassLevel

func (ElementFilterPass) Run

func (ElementFilterPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type ElementScoped added in v0.2.0

type ElementScoped interface{ ElementScoped() }

ElementScoped marks a pass whose subject is a single element rather than the document, so a failure on another element does not skip it. Such a pass names its subject in code and asks Context.DownstreamOfFailure about the references that subject rests on.

type EndFeaturePass added in v0.6.0

type EndFeaturePass struct{}

EndFeaturePass checks end features (KerML 8.3.3.1.5): an end feature has no direction and is not derived, abstract, composite or portion.

func (EndFeaturePass) ElementScoped added in v0.6.0

func (EndFeaturePass) ElementScoped()

ElementScoped: each end feature gates on its own head.

func (EndFeaturePass) Level added in v0.6.0

func (EndFeaturePass) Level() PassLevel

func (EndFeaturePass) Run added in v0.6.0

func (EndFeaturePass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type EnumerationBodyPass added in v0.5.0

type EnumerationBodyPass struct{}

EnumerationBodyPass reports a member an enumeration body cannot own. The grammar admits only enumerated values and annotating elements there (SysML.xtext `EnumerationBody`: `AnnotatingMember | EnumerationUsageMember`), so a nested definition, package, import, alias or the like is a notation error: the file still reads, so it gates no higher tier. An owned usage that is not an enumerated value is left to the variation-membership constraint, whose message names the fix.

func (EnumerationBodyPass) Level added in v0.5.0

func (EnumerationBodyPass) Run added in v0.5.0

func (EnumerationBodyPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type FeatureReferencePass added in v0.2.0

type FeatureReferencePass struct{}

FeatureReferencePass checks the features an expression names: a referent must be a feature (KerML 8.4.4.6.2/8.4.4.7.2), a featured one must be reachable from where it is named (8.3.4.5.2 validateSubsettingFeaturingTypes), and each feature of a declared chain must be featured within the one before it (8.3.3.3.4 validateFeatureChainingFeatureConformance).

func (FeatureReferencePass) Level added in v0.2.0

func (FeatureReferencePass) Run added in v0.2.0

type IdentityMetadataPass added in v0.4.3

type IdentityMetadataPass struct{}

IdentityMetadataPass validates the IdentityMetadata annotations of a document: id shape, the enclosing ProjectRef an ElementId resolves against, and effective-id uniqueness over the whole generated id space of each project scope (element ids, `_om` membership ids, `_p` expression-node ids).

func (IdentityMetadataPass) Level added in v0.4.3

func (IdentityMetadataPass) Run added in v0.4.3

type ImplicitBasePass added in v0.2.0

type ImplicitBasePass struct{}

ImplicitBasePass checks that a classifier reaches the standard-library supertype implied by its kind and that a feature has at least one type (KerML 1.0 validateClassifierDefaultSupertype, validateFeatureHasType). Both hold implicitly once the library is in the resource set, so they report a model whose resources do not supply it, or whose conjugation replaces it.

func (ImplicitBasePass) Level added in v0.2.0

func (ImplicitBasePass) Level() PassLevel

func (ImplicitBasePass) Run added in v0.2.0

func (ImplicitBasePass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type ImportVisibilityPass added in v0.1.2

type ImportVisibilityPass struct{}

ImportVisibilityPass reports an `import` written without the visibility indicator ImportPrefix makes mandatory (KerML.xtext:169-172, SysML.xtext:241-244). The reference rejects the bare form, so it is an error in every mode (D2, docs/project/adjudications.md); the form still parses and reads, so the finding is notation and gates no higher tier.

func (ImportVisibilityPass) Level added in v0.1.2

func (ImportVisibilityPass) Run added in v0.1.2

type KerMLSubsettingMetaclassPass added in v0.2.1

type KerMLSubsettingMetaclassPass struct{}

KerMLSubsettingMetaclassPass checks that a feature subsets another Feature.

func (KerMLSubsettingMetaclassPass) ElementScoped added in v0.2.1

func (KerMLSubsettingMetaclassPass) ElementScoped()

func (KerMLSubsettingMetaclassPass) Level added in v0.2.1

func (KerMLSubsettingMetaclassPass) Run added in v0.2.1

type MetadataAnnotationPass added in v0.2.0

type MetadataAnnotationPass struct{}

MetadataAnnotationPass checks a metadata annotation: what it may annotate, and that its body restates features of its type and binds model-level evaluable values (KerML 1.0 §7.4.9, §8.3.4.9).

func (MetadataAnnotationPass) Level added in v0.2.0

func (MetadataAnnotationPass) Run added in v0.2.0

type MetadataTypePass added in v0.2.0

type MetadataTypePass struct{}

MetadataTypePass reports an annotation (`@M`, `#M` or `metadata m : M`) whose type is not a concrete metaclass or metadata definition (KerML validateMetadataFeatureMetadata, validateMetadataFeatureMetadataNotAbstract; SysML validateMetadataUsageType).

func (MetadataTypePass) ElementScoped added in v0.2.0

func (MetadataTypePass) ElementScoped()

Its subject is one annotation, and the reference that subject rests on is the metaclass it names: a failure on another element does not hide it.

func (MetadataTypePass) Level added in v0.2.0

func (MetadataTypePass) Level() PassLevel

func (MetadataTypePass) Run added in v0.2.0

func (MetadataTypePass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type MultiplicityBoundsPass added in v0.2.0

type MultiplicityBoundsPass struct{}

MultiplicityBoundsPass checks that every multiplicity bound has a Natural value (KerML 8.3.3.1.9, validateMultiplicityRangeBoundResultTypes): a model-level evaluable bound must evaluate to a non-negative whole number or `*`, and any other bound must have an Integer-conforming result type.

func (MultiplicityBoundsPass) Level added in v0.2.0

func (MultiplicityBoundsPass) Run added in v0.2.0

type NameResolutionPass

type NameResolutionPass struct{}

NameResolutionPass resolves every reference in a document via the Plan-3 resolver and reports unresolved / ambiguous references.

func (NameResolutionPass) Level

func (NameResolutionPass) Level() PassLevel

Level reports the name-resolution dependency level.

func (NameResolutionPass) Run

func (NameResolutionPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

Run resolves the document and adapts resolver diagnostics.

type NonstandardNotationPass added in v0.1.2

type NonstandardNotationPass struct{}

NonstandardNotationPass reports extension notation and recoverable grammar violations without gating later semantic analysis.

func (NonstandardNotationPass) Level added in v0.1.2

Level reports the syntax level: the written notation is all it reads.

func (NonstandardNotationPass) Run added in v0.1.2

Run walks the document for extension and language-specific notation.

type OOSEMMethodPass added in v0.6.0

type OOSEMMethodPass struct{}

OOSEMMethodPass audits the artefacts a model classifies with the OOSEM library against the method's traceability and allocation rules. Each rule fires only once the model declares the artefacts the rule relates, so a model still being built is not told what it has not reached yet.

func (OOSEMMethodPass) Level added in v0.6.0

func (OOSEMMethodPass) Level() PassLevel

func (OOSEMMethodPass) Run added in v0.6.0

func (OOSEMMethodPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type Options added in v0.2.0

type Options struct {
	// Conformance is the strictness the notation is judged at.
	Conformance conformance.Mode
}

Options is the analysis configuration of one run. The zero value is what every existing caller gets: today's behavior, unchanged.

type Pass

type Pass interface {
	Level() PassLevel
	Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic
}

Pass is a single validation rule. Level reports its dependency tier; Run executes it over a whole document and returns any diagnostics found.

type PassLevel

type PassLevel int

PassLevel is the dependency tier of a validation pass. Passes at a higher level are skipped when a lower level produced an error, avoiding cascade noise (e.g. no type-check on an unresolved reference).

const (
	LevelSyntax PassLevel = iota
	LevelNameResolution
	LevelType
	LevelConstraint
)

func (PassLevel) String

func (l PassLevel) String() string

String returns the lowercase name of the level, or "unknown".

type RedefinitionConformancePass added in v0.2.0

type RedefinitionConformancePass struct{}

RedefinitionConformancePass reports the feature-conformance rules a subsetting or redefinition breaks: direction, uniqueness and constancy (KerML 8.3.3.3). The predicates live in semantics; this pass only locates and words them.

func (RedefinitionConformancePass) Level added in v0.2.0

func (RedefinitionConformancePass) Run added in v0.2.0

type RedefinitionDirectionPass added in v0.2.0

type RedefinitionDirectionPass struct{}

RedefinitionDirectionPass reports direction conformance as a typing property.

func (RedefinitionDirectionPass) Level added in v0.2.0

func (RedefinitionDirectionPass) Run added in v0.2.0

type ReferenceSubsettingPass added in v0.2.0

type ReferenceSubsettingPass struct{}

ReferenceSubsettingPass checks that a feature owns at most one reference subsetting (`references`/`::>`), KerML 8.3.3.1.5. Every reference subsetting after the first is reported, as the pilot does.

func (ReferenceSubsettingPass) Level added in v0.2.0

func (ReferenceSubsettingPass) Run added in v0.2.0

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds an ordered set of validation passes.

func DefaultRegistry

func DefaultRegistry() *Registry

DefaultRegistry returns the default pass registry: syntax, name resolution, state transitions, type checking, and semantic constraints.

func NewRegistry

func NewRegistry() *Registry

NewRegistry returns an empty registry.

func (*Registry) Passes added in v0.4.3

func (r *Registry) Passes() []Pass

Passes returns the registered passes in registration order.

func (*Registry) Register

func (r *Registry) Register(p Pass)

Register adds a pass to the registry.

func (*Registry) Run

func (r *Registry) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

Run executes all registered passes in ascending PassLevel order and returns their accumulated diagnostics. A pass whose subject is the document is skipped once a strictly lower level emitted a blocking diagnostic, avoiding cascade noise; an ElementScoped pass runs and gates itself per element. Passes at the same level always run.

type ResultExpressionPass added in v0.2.0

type ResultExpressionPass struct{}

ResultExpressionPass checks that a function or expression has at most one result expression, owned or inherited (KerML 8.3.4.6 Expression::result, 8.3.4.8 Function::result). A calculation body states at most one; a type that inherits a result expression cannot state its own — a specialization or redefinition keeps the inherited body or adds constraints beside it — and one that inherits two along different specializations is invalid on its own.

func (ResultExpressionPass) ElementScoped added in v0.6.0

func (ResultExpressionPass) ElementScoped()

ElementScoped: each type gates on the head naming its supertypes.

func (ResultExpressionPass) Level added in v0.2.0

func (ResultExpressionPass) Run added in v0.2.0

type SendActionPass added in v0.5.0

type SendActionPass struct{}

SendActionPass types the payload, `via` and `to` arguments of every send and checks the SysML v2 SendActionUsage constraints on them.

func (SendActionPass) ElementScoped added in v0.5.0

func (SendActionPass) ElementScoped()

ElementScoped lets each send argument gate independently on lower failures.

func (SendActionPass) Level added in v0.5.0

func (SendActionPass) Level() PassLevel

Level reports that this pass consumes name-resolution results.

func (SendActionPass) Run added in v0.5.0

func (SendActionPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

Run checks every send in the document.

type Severity

type Severity int

Severity classifies the impact of a Diagnostic.

const (
	SeverityError Severity = iota
	SeverityWarning
	SeverityInfo
	SeverityHint
)

func (Severity) String

func (s Severity) String() string

String returns the lowercase name of the severity, or "unknown".

type StateTransitionPass

type StateTransitionPass struct{}

StateTransitionPass checks that every transition names one source and one target vertex of its own machine (UML 2.5.1 §14.2.3.9), and that a routing pseudostate is left by one (§15.7.18).

func (StateTransitionPass) Level

Level reports the name-resolution level: resolved endpoints are all it reads.

func (StateTransitionPass) Run

func (StateTransitionPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

Run checks every state machine the document declares.

type SyntaxPass

type SyntaxPass struct{}

SyntaxPass surfaces the parser-produced diagnostics carried on the Context. The passes package does not import parser; the caller adapts parser diagnostics into passes.Diagnostic and stores them on Context.ParseDiagnostics.

func (SyntaxPass) Level

func (SyntaxPass) Level() PassLevel

Level reports that syntax is the lowest dependency level.

func (SyntaxPass) Run

func (SyntaxPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

Run returns the parse diagnostics carried on the context.

type TopLevelImportPass added in v0.2.0

type TopLevelImportPass struct{}

TopLevelImportPass checks that an import owned by the root namespace is private (KerML 8.2.3.4.2, validateImportTopLevelVisibility): a root namespace has no owner, so a non-private import there exports into nothing. It runs at the constraint tier so a recovered parse is not reported on twice and this error does not gate the type and constraint tiers.

func (TopLevelImportPass) Level added in v0.2.0

func (TopLevelImportPass) Level() PassLevel

func (TopLevelImportPass) Run added in v0.2.0

func (TopLevelImportPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type TransitionGuardPass added in v0.2.1

type TransitionGuardPass struct{}

TransitionGuardPass checks that each transition guard is Boolean-valued, including the guarded successions of an action body (`first a if x then b;`).

func (TransitionGuardPass) ElementScoped added in v0.2.1

func (TransitionGuardPass) ElementScoped()

func (TransitionGuardPass) Level added in v0.2.1

func (TransitionGuardPass) Run added in v0.2.1

func (TransitionGuardPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type TriggerArgumentPass added in v0.5.1

type TriggerArgumentPass struct{}

TriggerArgumentPass types the argument of every `after`, `at` or `when` trigger, each gated on its own argument rather than the whole document.

func (TriggerArgumentPass) ElementScoped added in v0.5.1

func (TriggerArgumentPass) ElementScoped()

func (TriggerArgumentPass) Level added in v0.5.1

func (TriggerArgumentPass) Run added in v0.5.1

func (TriggerArgumentPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type TypeCheckPass

type TypeCheckPass struct{}

TypeCheckPass validates that each def/usage relationship target has a symbol kind compatible with the source node and relationship kind (spec §6.3), and types expressions (operands, bound values, invocation arguments) against the stdlib scalar lattice. It runs at LevelType, after name resolution; unresolved targets are skipped.

func (TypeCheckPass) Level

func (TypeCheckPass) Level() PassLevel

func (TypeCheckPass) Run

func (TypeCheckPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type TypeRelationshipsPass added in v0.2.0

type TypeRelationshipsPass struct{}

TypeRelationshipsPass checks the union, intersection, difference and chaining relationships a type owns for a single operand or a self operand (KerML 8.3.3.1.2, 8.3.3.1.5). Constraint tier: the self rules resolve targets.

func (TypeRelationshipsPass) Level added in v0.2.0

func (TypeRelationshipsPass) Run added in v0.2.0

type VariableFeaturePass added in v0.2.0

type VariableFeaturePass struct{}

VariableFeaturePass checks feature variability (KerML 8.3.3.1.5): a `var` feature is owned by an occurrence type and is no portion; only a variable feature is initialized or constant.

func (VariableFeaturePass) ElementScoped added in v0.5.1

func (VariableFeaturePass) ElementScoped()

ElementScoped: each feature gates on its own head and its owner's.

func (VariableFeaturePass) Level added in v0.2.0

func (VariableFeaturePass) Run added in v0.2.0

func (VariableFeaturePass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type W8DConnectorFeaturingPass added in v0.2.0

type W8DConnectorFeaturingPass struct{}

W8DConnectorFeaturingPass checks that each end of a connector names a feature featured within the connector's own featuring type (KerML 1.0 §8.3.3.3, Feature::isFeaturedWithin): a nested feature is reached with dot notation, not with `::`.

func (W8DConnectorFeaturingPass) Level added in v0.2.0

func (W8DConnectorFeaturingPass) Run added in v0.2.0

type W8DFlowEndPass added in v0.2.0

type W8DFlowEndPass struct{}

W8DFlowEndPass checks that a flow's ends name features of the flow's own context rather than members of an unrelated definition (SysML v2 §8.3.17).

func (W8DFlowEndPass) Level added in v0.2.0

func (W8DFlowEndPass) Level() PassLevel

func (W8DFlowEndPass) Run added in v0.2.0

func (W8DFlowEndPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type W8DMetadataUsagePass added in v0.2.0

type W8DMetadataUsagePass struct{}

W8DMetadataUsagePass checks that every feature in a `metadata m : A { … }` usage body redefines one of A's own and binds a model-level evaluable value (KerML §7.5); the type itself is MetadataTypePass's. It runs at the tier MetadataAnnotationPass reports the same rules for the `@A { … }` spelling.

func (W8DMetadataUsagePass) Level added in v0.2.0

func (W8DMetadataUsagePass) Run added in v0.2.0

type W8DOccurrenceTypingPass added in v0.2.0

type W8DOccurrenceTypingPass struct{}

W8DOccurrenceTypingPass checks that an occurrence, item or part is typed by occurrence definitions only (SysML v2 §8.3.9.11, OccurrenceUsage).

func (W8DOccurrenceTypingPass) Level added in v0.2.0

func (W8DOccurrenceTypingPass) Run added in v0.2.0

type W8DVariabilityPass added in v0.2.0

type W8DVariabilityPass struct{}

W8DVariabilityPass checks that every usage a variation owns is a variant and that a variation does not specialize another variation (SysML v2 §7.20). An enumeration definition is a variation without saying so (SysML v2 §7.6.4).

func (W8DVariabilityPass) Level added in v0.2.0

func (W8DVariabilityPass) Level() PassLevel

func (W8DVariabilityPass) Run added in v0.2.0

func (W8DVariabilityPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type W8DVerificationPass added in v0.2.0

type W8DVerificationPass struct{}

W8DVerificationPass checks that a `verify` appears only in the objective of a verification case (SysML v2 §8.3.24).

func (W8DVerificationPass) Level added in v0.2.0

func (W8DVerificationPass) Run added in v0.2.0

func (W8DVerificationPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type W8DViewRenderingPass added in v0.2.0

type W8DViewRenderingPass struct{}

W8DViewRenderingPass checks that a view owns at most one view rendering (SysML v2 §8.3.26); a plain `rendering` member is no view rendering and does not count.

func (W8DViewRenderingPass) Level added in v0.2.0

func (W8DViewRenderingPass) Run added in v0.2.0

type W9CBoundFeatureTypesPass added in v0.2.0

type W9CBoundFeatureTypesPass struct{}

W9CBoundFeatureTypesPass checks that the two features a binding connector binds have conforming types (SysML 8.3.3.1, KerML 8.3.4.3): binding features of unrelated types cannot be satisfied. Besides `bind a = b` it judges the bindings the language implies: a function's result expression to its result parameter, a subject's value or the subject of a `satisfy … by` to the subject it fills, and a nested requirement's subject to its owner's.

func (W9CBoundFeatureTypesPass) Level added in v0.2.0

func (W9CBoundFeatureTypesPass) Run added in v0.2.0

type W9CInheritedNameConflictPass added in v0.2.0

type W9CInheritedNameConflictPass struct{}

W9CInheritedNameConflictPass warns when a declaration reuses a member name a library definition it conforms to already supplies — `state start;` inside a state, against StatePerformances::StateAction::start — and when two such definitions each supply a feature of one name: `action a : ABlock` inherits `self`, `start` and `done` from both Actions::Action and Parts::Part. The resolver's own rule covers only the document's own supertypes.

func (W9CInheritedNameConflictPass) Level added in v0.2.0

func (W9CInheritedNameConflictPass) Run added in v0.2.0

type W9CShortNameDistinguishabilityPass added in v0.2.0

type W9CShortNameDistinguishabilityPass struct{}

W9CShortNameDistinguishabilityPass reports the short names one namespace uses twice, or that repeat another member's name: a short name is a name for distinguishability (KerML 7.2.2). Resolve's own rule keys on primary names, so it never sees these.

func (W9CShortNameDistinguishabilityPass) Level added in v0.2.0

func (W9CShortNameDistinguishabilityPass) Run added in v0.2.0

type W9CUserStandardLibraryPass added in v0.2.0

type W9CUserStandardLibraryPass struct{}

W9CUserStandardLibraryPass reports a `standard library package` written outside the standard library: only the library's own packages may claim it (KerML 7.2.4).

func (W9CUserStandardLibraryPass) Level added in v0.2.0

func (W9CUserStandardLibraryPass) Run added in v0.2.0

type W10BEndKindPass added in v0.2.0

type W10BEndKindPass struct{}

W10BEndKindPass checks the kind and the number of end features an interface or a flow connection definition declares. It is level-scoped to the type tier like the usage-typing rules it accompanies, since the reference reports both on the same declaration.

func (W10BEndKindPass) Level added in v0.2.0

func (W10BEndKindPass) Level() PassLevel

func (W10BEndKindPass) Run added in v0.2.0

func (W10BEndKindPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type W10BIndividualTypingPass added in v0.2.0

type W10BIndividualTypingPass struct{}

W10BIndividualTypingPass checks that a usage carrying the `individual` modifier is typed by exactly one individual definition (SysML v2 §8.3.9.11). Other types are allowed beside it, as they are in the reference.

func (W10BIndividualTypingPass) Level added in v0.2.0

func (W10BIndividualTypingPass) Run added in v0.2.0

type W10BPortionOwnerPass added in v0.2.0

type W10BPortionOwnerPass struct{}

W10BPortionOwnerPass checks that a `snapshot` or `timeslice` usage is owned by an occurrence definition or usage: a portion of an occurrence needs the occurrence it is a portion of (SysML v2 §8.3.9.11).

func (W10BPortionOwnerPass) Level added in v0.2.0

func (W10BPortionOwnerPass) Run added in v0.2.0

type W10BRelatedElementsPass added in v0.2.0

type W10BRelatedElementsPass struct{}

W10BRelatedElementsPass reports a concrete association with fewer than two ends, or a concrete connector whose ends reference fewer than two features: a link needs two participants (KerML 1.1 §8.3.3.5, §8.3.4.7). An abstract declaration is exempt, as it is in the reference — its ends are the specialization's to supply. A binding connector, abstract or not, must bind exactly two features (§8.3.4.7.2 validateBindingConnectorIsBinary).

func (W10BRelatedElementsPass) Level added in v0.2.0

func (W10BRelatedElementsPass) Run added in v0.2.0

type W10BStructuralPass added in v0.2.0

type W10BStructuralPass struct{}

W10BStructuralPass checks how many members of a kind a declaration owns and whether they may be composite. The rules read the declaration only, so they sit at the type tier rather than behind it.

func (W10BStructuralPass) Level added in v0.2.0

func (W10BStructuralPass) Level() PassLevel

func (W10BStructuralPass) Run added in v0.2.0

func (W10BStructuralPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type W11AKerMLSpecializationPass added in v0.2.0

type W11AKerMLSpecializationPass struct{}

W11AKerMLSpecializationPass checks the kind of a classifier's supertypes: a data type specializes neither a class nor an association, a class neither a data type nor an association, and a structure and a behavior do not specialize each other (KerML 1.0 §8.4.4). A SysML definition is a classifier of the family its metaclass specializes, and its data type and class rules are worded in SysML terms (SysML v2 §8.3.7.2, §8.3.10.2).

func (W11AKerMLSpecializationPass) Level added in v0.2.0

func (W11AKerMLSpecializationPass) Run added in v0.2.0

type W11AUsageTypingPass added in v0.2.0

type W11AUsageTypingPass struct{}

W11AUsageTypingPass checks the kind of a usage's type where the typing is inherited through a subsetting, redefinition or reference subsetting, and the kind of the feature a `perform`/`exhibit` member references.

func (W11AUsageTypingPass) Level added in v0.2.0

func (W11AUsageTypingPass) Run added in v0.2.0

func (W11AUsageTypingPass) Run(ctx *Context, name string, root *ast.RootNamespace) []Diagnostic

type W11EConjugatedSpecializationPass added in v0.2.0

type W11EConjugatedSpecializationPass struct{}

W11EConjugatedSpecializationPass checks that a conjugated type is not the specific type of a specialization (KerML 1.0 validateSpecializationSpecificNotConjugated). The specialization metaclass rules are W11AKerMLSpecializationPass's, and this pass shares its level so a kind error does not suppress this one.

func (W11EConjugatedSpecializationPass) Level added in v0.2.0

func (W11EConjugatedSpecializationPass) Run added in v0.2.0

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL