Skip to content

Conversation

@beccadax
Copy link
Contributor

@beccadax beccadax commented Dec 19, 2025

There were a number of cases where Swift would emit module selectors into module interface files that it was subsequently unable to parse because the compiler at least temporarily represented them as dependent member types. Modify the carve-out so that if any of a type’s parents are generic parameters or archetypes, we don’t print a module selector on it.

Fixes rdar://166180424.

The old -module-interface-preserve-types-as-written workaround flag prevents module selectors from being printed into module interfaces even when they have been explicitly requested. Disable it and emit a warning when it’s used in combination with -enable-module-selectors-in-module-interface.

Fixes rdar://166237384.

(These have been rolled into a single PR because the test changes intersect.)

@beccadax
Copy link
Contributor Author

@swift-ci please smoke test

parent = generic->getParent();
return parent && parent->isTypeParameter();
else if (auto dmt = T->getAs<DependentMemberType>())
parent = dmt->getBase();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base of a DependentMemberType should always be a type parameter, so you can just return true here without recursing

There were a number of cases where Swift would emit module selectors into module interface files that it was subsequently unable to parse because the compiler at least temporarily represented them as dependent member types. Modify the carve-out so that if *any* of a type’s parents are generic parameters or archetypes, we don’t print a module selector on it.

Fixes rdar://166180424.
@beccadax beccadax force-pushed the mod-squad-independent branch from d09c47f to 817821a Compare December 19, 2025 22:02
@beccadax beccadax requested a review from artemcm as a code owner December 19, 2025 22:02
The old `-module-interface-preserve-types-as-written` workaround flag prevents module selectors from being printed into module interfaces even when they have been explicitly requested. Disable it and emit a warning when it’s used in combination with `-enable-module-selectors-in-module-interface`.

Fixes rdar://166237384.
@beccadax beccadax force-pushed the mod-squad-independent branch from 817821a to ad77857 Compare December 19, 2025 22:06
@beccadax beccadax changed the title Don’t print module selectors in more cases Don’t print module selectors in more cases + Disable preserve-types when using module selectors Dec 19, 2025
@beccadax
Copy link
Contributor Author

@swift-ci please smoke test

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