Unify canonical sequence index semantics for version decoding

This commit is contained in:
2026-09-12 01:31:54 +00:00
parent fd8a68d268
commit 244104f84f
5 changed files with 183 additions and 24 deletions

View File

@@ -2,7 +2,6 @@ package configkit
import (
"reflect"
"strconv"
"gitea.maximumdirect.net/eric/ConfigKit/internal/document"
)
@@ -238,26 +237,7 @@ func isIntegerVersion(node *document.Node) bool {
}
func pathMatches(configured *Path, current Path) bool {
if configured == nil || !configured.valid() || !current.valid() || len(configured.segments) != len(current.segments) {
return false
}
for i, expected := range configured.segments {
actual := current.segments[i]
if expected.kind == pathSegmentParsed {
if actual.kind == pathSegmentIndex {
if expected.key != strconv.Itoa(actual.index) {
return false
}
} else if expected.key != actual.key {
return false
}
continue
}
if expected.kind != actual.kind || expected.key != actual.key || expected.index != actual.index {
return false
}
}
return true
return configured != nil && current.valid() && matchesPathShape(*configured, current)
}
func documentLocationPointer(location document.Location) *Location {