Skip to content

[5.8][CSGen] Detect nested out-of-scope variables in recursive declarations #63642

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 1 commit into from
Feb 17, 2023

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Feb 13, 2023

Cherry-pick of #63566


  • Explanation:

Follow-up to #63505

An out-of-scope type variable(s) could appear the type of
a declaration only in diagnostic mode when invalid variable
declaration is recursively referenced inside of a multi-statement
closure located somewhere within its initializer e.g.:
let x = [<call>] { ... print(x) }. It happens because the
variable assumes the result type of its initializer unless
its specified explicitly.

Resolves: #63455
(cherry picked from commit 8e82f1d)

Follow-up to swiftlang#63505

Since, when the type is not stated, a variable assumes the
type of its initializer that enables out-of-scope variables
to be nested inside of some other concrete type i.e. Optional.

Resolves: swiftlang#63455
(cherry picked from commit 8e82f1d)
@xedin xedin added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.8 labels Feb 13, 2023
@xedin xedin requested a review from hborla February 13, 2023 23:38
@xedin xedin requested a review from a team as a code owner February 13, 2023 23:38
@xedin
Copy link
Contributor Author

xedin commented Feb 13, 2023

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Feb 13, 2023

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Feb 17, 2023

@swift-ci please smoke test macOS platform

@xedin xedin merged commit abbaaa9 into swiftlang:release/5.8 Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants