Skip to content

IRGen: Fix enable-testing of internal with resilient super class #42063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

aschwaighofer
Copy link
Contributor

Enable testing makes internal types visible from outside the module.
We can no longer treat super classes as resilient.

Follow-up to #41044.

rdar://90489618

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

/*useDC=*/nullptr,
/*treatUsableFromInlineAsPublic=*/true)
.isPublic());
if (IGM.hasResilientMetadata(superclassDecl,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we fold this into a new IGM.hasResilientSuperclass() which takes the class (and not the superclass) and then does the necessary checks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to "pass down" the fact that the super class is not to be treated as resilient to the recursive call addFieldsForClass /addClassMembers on the super class.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, maybe there's some other way, but this is the second bug we've fixed related to enable-testing vs class resilience, and it looks like both fixes added accidental complexity. We're just factoring the computations incorrectly here.

Enable testing makes `internal` types visible from outside the module.
We can no longer treat super classes as resilient.

Follow-up to swiftlang#41044.

rdar://90489618
@aschwaighofer aschwaighofer force-pushed the fix_internal_resilient_super_class_with_enable_testing branch from b7f0138 to 3930fc4 Compare March 30, 2022 14:13
@aschwaighofer
Copy link
Contributor Author

@slavapestov I have changed the patch so that we are now additionally passing a rootClass parameter (the most derived sub class we are currently looking at) to the isResilient... predicates. And implemented the check inside the predicates.

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@aschwaighofer aschwaighofer merged commit 70044d7 into swiftlang:main Mar 30, 2022
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.

2 participants