Commit 58e04dc
committed
feat(deps): SemVer merge — Level 2 of multi-version resolution
When the transitive walker encounters the same package twice with different
pinned versions, AND-combine the two original constraints and re-query the
index for a single satisfying version. Bare exact pins like `0.0.1` are
treated as `=0.0.1` so they participate cleanly in the AND.
If the merged pin differs from the previously-recorded one, the dep is
re-fetched at the merged version: the slot in `dep_manifests`/`packages`
is replaced in-place, the old `[build].include_dirs` entries are evicted
from the main manifest, the new ones are appended, and the new manifest's
children are pushed onto the worklist. Same pin → just record the new
consumer; no overlap → hard error with a Level-1 mangling hint.
Code shape:
- `mcpp.pm.resolver::try_merge_semver` is the new public helper.
- `cli.cppm`'s resolve loop tracks `originalConstraint` per WorkItem and
`constraint` / `depIndex` / `includeDirsAdded` per ResolvedRecord.
- The version-source manifest acquisition (install + xpkg-lua field
dispatch) is factored into `loadVersionDep` so the merger can re-use it.
Tests: new `32_semver_merge.sh` covers the compatible-merge happy path
(`=0.0.1` ⨯ `>=0.0.1, <1` → 0.0.1, with the previously-pinned 0.0.2 slot
overwritten) and the irreconcilable case (`=0.0.1` ⨯ `=0.0.2` still
errors). Existing 31_transitive_deps stays green.
CHANGELOG: opens 0.0.3 entry covering both PR #17 (transitive walker)
and this one (SemVer merge); the Level-1 mangling fallback follows in a
separate PR before tagging 0.0.3.1 parent b835590 commit 58e04dc
4 files changed
Lines changed: 487 additions & 169 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
7 | 27 | | |
8 | 28 | | |
9 | 29 | | |
| |||
0 commit comments