Skip to content

ModuleInterface: Resolve types of CustomAttrs when printing #69560

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

tshortli
Copy link
Contributor

When printing the CustomAttrs attached to a decl, those attrs may not have been type checked yet if lazy typechecking is enabled. We need to make sure that printing invokes a request that will resolve the type.

Resolves rdar://117443319

When printing the CustomAttrs attached to a decl, those attrs may not have been
type checked yet if lazy typechecking is enabled. We need to make sure that
printing invokes a request that will resolve the type.

Resolves rdar://117443319
@tshortli
Copy link
Contributor Author

@swift-ci please smoke test

auto attr = cast<CustomAttr>(this);
if (auto type = attr->getType()) {
if (auto type =
D->getResolvedCustomAttrType(const_cast<CustomAttr *>(attr))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should getType() be made private?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are a lot of existing uses of getType() that don't need to go through something like getResolvedCustomAttrType() because they get called on a CustomAttr that was retrieved via a request that resolves the type. It's only when printing or serializing that we work with CustomAttrs abstractly (without knowing that we want a result builder, property wrapper, etc.) and therefore need this.

@tshortli tshortli merged commit 8f466f7 into swiftlang:main Nov 1, 2023
@tshortli tshortli deleted the module-interface-lazy-typecheck-qualified-global-actors branch November 1, 2023 04:16
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