Skip to content

Conversation

@hamishknight
Copy link
Contributor

Clean up a bit of property wrapper logic in the constraint system and fix a couple of crashers.

@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight
Copy link
Contributor Author

@swift-ci please test source compatibility

And make sure we mark any PatternBindingDecl entries as having
been checked to avoid re-checking. This fixes a crash where we could
attempt to re-check a property wrapper to compute its backing type.
Rather than computing these each time we need to solve an element that
has a reference to them, let's just set them up-front when we generate
constraints for the corresponding variable.
These methods can be simplified a bunch since the returned decl is
always the input decl and we can refactor the lambdas to just return
the auxiliary variable and have the type computation in the caller.
Make sure we query the constraint system for a type if we have a local
property wrapper in a closure to avoid kicking interface type
computation outside the closure, and make sure we map into context if
we need to.
@hamishknight
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

if (!var)
return Action::Continue(expr);

if (auto *wrappedVar = var->getOriginalWrappedProperty()) {
Copy link
Contributor

@xedin xedin Nov 5, 2025

Choose a reason for hiding this comment

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

I'm trying to remember why I did it this way and failing, we might have done something differently back then...

@hamishknight hamishknight merged commit dad2637 into swiftlang:main Nov 5, 2025
3 checks passed
@hamishknight hamishknight deleted the wrapping-paper branch November 5, 2025 19:51
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