Skip to content

Fix conditional traits not reaching already visited packages - #10579

Merged
plemarquand merged 1 commit into
swiftlang:release/6.4.2from
plemarquand:conditional-traits-reach-already-visited-packages
Sep 24, 2026
Merged

plemarquand merged 1 commit into
swiftlang:release/6.4.2from
plemarquand:conditional-traits-reach-already-visited-packages

Conversation

@plemarquand

@plemarquand plemarquand commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

After manifests are loaded, loadDependencyManifests makes a pass of updateEnabledTraits over all packages, in traversal order.

Consider the following package graph:

App ─┬─ Server ─ Proposal ─[B]─ Middle ─[L when B]─ Leaf
     └─ Console ─┬─ Middle (defaults)
                 └─ Leaf   (defaults)

Leaf is processed while Middle still only has its defaults. Later in the same pass Middle gains the trait B, which would turn on L for Leaf, but Leaf has already been processed and is never revisited, so the graph builds Leaf without L.

Repeat the pass until no package's trait names change. This makes the result independent of traversal order. It always stops, because traits are only ever added.

@plemarquand

Copy link
Copy Markdown
Contributor Author

@swift-ci test

@plemarquand

plemarquand commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Fixes apple/swift-collections#726

@rconnell9

Copy link
Copy Markdown
Collaborator

@plemarquand Can you re-target to release/6.4.2, will automerge it to the rest.

@plemarquand
plemarquand changed the base branch from main to release/6.4.2 September 23, 2026 23:01
After manifests are loaded, `loadDependencyManifests` makes a pass of
`updateEnabledTraits` over all packages, in traversal order.

Consider the following package graph:

```
    App ─┬─ Server ─ Proposal ─[B]─ Middle ─[L when B]─ Leaf
          └─ Console ─┬─ Middle (defaults)
                      └─ Leaf   (defaults)
```

Leaf is processed while Middle still only has its defaults. Later in
the same pass Middle gains the trait `B`, which would turn on `L` for
Leaf, but Leaf has already been processed and is never revisited, so
the graph builds Leaf without `L`.

Repeat the pass until no package's trait names change. This makes the
result independent of traversal order. It always stops, because traits
are only ever added.
@plemarquand
plemarquand force-pushed the conditional-traits-reach-already-visited-packages branch from dad4efd to 2fb76e0 Compare September 23, 2026 23:07
@plemarquand

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@plemarquand
plemarquand enabled auto-merge (squash) September 24, 2026 10:46
@plemarquand

Copy link
Copy Markdown
Contributor Author

@swift-ci test windows

@plemarquand

Copy link
Copy Markdown
Contributor Author

@swift-ci test windows platform

@plemarquand
plemarquand merged commit a858aaa into swiftlang:release/6.4.2 Sep 24, 2026
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants