Track the main version through sequence movement
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user