Skip to content

Conversation

bripeticca
Copy link
Contributor

@bripeticca bripeticca commented Sep 15, 2025

  • Explanation:
    Fixes some errors in trait computation that hadn't considered when default traits ["default"] were being appended to the EnabledTraitsMap, which should only consider a list of flattened traits + explicitly enabled traits by a user/parent package. The inclusion of default in this dictionary was resulting in an inaccurate computation of which traits were enabled, since pre-computation serves to flatten the list of transitively enabled traits for future reference.
    There were also cases where we were re-computing transitively enabled traits in areas where we had already filled out the enabledTraitsMap, so we now default to simply fetching the entry from the dictionary instead of computing the traits all over again.

  • Scope:
    Fixes trait-related computation in dependency resolution

  • Issues:

  • Original PRs:
    Fix pre-computation of traits when loading dependency manifests #9057

  • Risk:
    Low risk

  • Testing:
    Added new fixtures + regression tests to address the behaviour that was previously incorrect.

  • Reviewers:
    @dschaefer2

…tlang#9057)

This fix addresses some issues that arose with trait-based dependency
resolution on Linux and, found through development, a related issue
found involving the `swift package show-dependencies` command. It fixes
an error that was thrown as a discrepancy in state when executing `swift
package show-dependencies` if traits were guarding a dependency and was
omitted from the package graph.

Additionally, this will assure that the `EnabledTraitsMap` guards
against explicitly adding "default" traits to the stored dictionary,
since this wrapper is a mechanism to determine whether traits have been
explicitly set (and therefore have overridden "default" or have
flattened the list of default traits).
@bripeticca
Copy link
Contributor Author

@swift-ci please test

@bripeticca bripeticca marked this pull request as ready for review September 15, 2025 16:02
@bripeticca bripeticca requested a review from a team as a code owner September 15, 2025 16:02
@rconnell9
Copy link
Contributor

@swift-ci test windows

@bripeticca bripeticca merged commit 76e7221 into swiftlang:release/6.2 Sep 18, 2025
6 checks passed
stephencelis referenced this pull request in bok-/swift-structured-queries-with-traits Sep 26, 2025
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.

4 participants