Skip to content

[CSGen] Don't increase optionality of weak var patterns #39162

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

Merged
merged 2 commits into from
Sep 6, 2021

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Sep 3, 2021

If the externally-imposed type is already optional,
let's not add optionality to the pattern.

If the externally-imposed type is already optional,
let's not add optionality to the pattern.
@xedin xedin requested a review from hborla September 3, 2021 18:00
- Make sure that `varType` is wrapped into an optional type for `weak`
  declarations.
- Verify that `externalPatternType` is an optional type when one-way
  constraints are requested.
@xedin
Copy link
Contributor Author

xedin commented Sep 4, 2021

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Sep 4, 2021

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Sep 6, 2021

Source compatibility is UPASS.

@xedin xedin merged commit 021349f into swiftlang:main Sep 6, 2021
@davezarzycki
Copy link
Contributor

Whoa. Interesting. How did this not get caught until now?

@hborla
Copy link
Member

hborla commented Sep 7, 2021

@davezarzycki because this code currently only applies to result builder bodies, and nobody has written a local weak var in a result builder. Pavel found this while working on multi-statement closure inference in the constraint system.

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