Track the main version through sequence movement

This commit is contained in:
2026-10-24 01:11:28 +00:00
parent af84107905
commit 5bb4f364b7
8 changed files with 359 additions and 9 deletions

View File

@@ -27,11 +27,12 @@ func containsInheritanceDirective(root *document.Node) bool {
return visit(root)
}
func inheritanceVersionDiagnostic(rule *VersionRule, expanded *inheritanceScope) *Diagnostic {
func projectInheritanceVersion(rule *VersionRule, expanded *inheritanceScope) (*VersionRule, *Diagnostic) {
if rule == nil || expanded == nil {
return nil
return rule, nil
}
for _, operation := range expanded.operations {
rule = projectVersionRule(rule, operation.sequences)
var location Location
var affected bool
if operation.control != nil {
@@ -50,13 +51,13 @@ func inheritanceVersionDiagnostic(rule *VersionRule, expanded *inheritanceScope)
}
}
if affected {
return &Diagnostic{
return rule, &Diagnostic{
Code: CodeInheritanceVersion, Severity: SeverityError, Path: rule.Path.clone(),
Message: "inheritance cannot change the schema-version path", Primary: &location,
}
}
}
return nil
return rule, nil
}
func inheritanceOperations(expanded *inheritanceScope) []inheritanceOperation {