fix(schema): make the container-location root fallback live

containerLocationMap stored `loc ?? rootLocation` into a [ObjectIdentifier:
String?]. Because the value type is itself optional the coalescing bound at the
outer optional and rootLocation was never used (the compiler flagged it), so a
container with no location of its own (the compile root) mapped to nil even when
a circular import had loaded the root under a schemaLocation. An explicit String?
annotation keeps the coalescing at the String level so the root inherits
rootLocation.

Conformance is unchanged: 1448 unit tests pass and the full XSTS suite still
settles at 0/43/0/31. The SchemaNameUniqueness root-index dedup case is kept, not
removed: an experiment removing it on the theory it was now redundant regressed
three valid schemas to rejected, so it does real work beyond the fixed fallback.
This commit is contained in:
Mihaela Mihaljevic 2026-06-19 22:42:02 +02:00
parent 73ba9b1f38
commit cd6201ca5c
2 changed files with 16 additions and 1 deletions

View File

@ -28,6 +28,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed a dead `rootLocation` fallback in `XSDParser.containerLocationMap`. The
map value type is itself `String?`, so `loc ?? rootLocation` bound the
coalescing at the outer optional and never used `rootLocation` (the compiler
flagged it), leaving the compile root mapped to nil even when a circular import
had loaded it under a `schemaLocation`. An explicit `String?` annotation keeps
the coalescing at the `String` level so the root inherits its location.
Conformance is unchanged (XSTS still settles at 0/43/0/31); the
`SchemaNameUniqueness` root-index dedup case is retained, not removed, because
removing it on the theory it was now redundant regressed three valid schemas to
rejected, so it does real work beyond the fixed fallback.
- Bounded the content-model matcher's active-configuration set per counter
(`ContentNFA`/`ContentMatcher`). Each occurrence counter now saturates at
`min(maximum, inputLength + 1)`, and an unbounded counter at its `minimum`

View File

@ -64,7 +64,11 @@ extension PureXML.Schema.XSDParser {
) -> [ObjectIdentifier: String?] {
var containerLocations: [ObjectIdentifier: String?] = [:]
for (loc, tree) in containerTuples {
containerLocations[ObjectIdentifier(tree)] = loc ?? rootLocation
// The map value is itself `String?`, so the explicit annotation keeps
// `??` at the `String` level; without it the fallback binds at the
// outer optional and the compile root (no location) maps to nil.
let location: String? = loc ?? rootLocation
containerLocations[ObjectIdentifier(tree)] = location
}
return containerLocations
}