Skip to content
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

[6.1] AST: Avoid creating duplicate AvailabilityScopes under SequenceExprs #78719

Merged

Conversation

tshortli
Copy link
Contributor

  • Explanation: Addresses an issue that causes malformed AvailabilityScope trees to be formed, which could cause incorrect results when querying for the availability context at a given source location. Practically speaking, the issue prevented here was not causing any user visible issues. However, it was causing development toolchains to crash when compiling some code because of an AST verification failure. The fix tactically adjusts how AvailabilityScopeBuilder handles SequenceExprs in the AST, ensuring that their subexpressions are not visited multiple times.
  • Scope: Affects how availability scopes are computed for expressions involving operators.
  • Issue/Radar: rdar://142824799, Compiler crash with message "overlapping children" #78567
  • Original PR: AST: Fix SequenceExpr handling in AvailabilityScopeBuilder #78706
  • Risk: Low. This fix narrowly targets how SequenceExprs are handled.
  • Testing: New tests added to the test suite.
  • Reviewer: @xedin

Since availability scopes may be built at arbitrary times, the builder may
encounter ASTs where SequenceExprs still exist and have not been folded, or it
may encounter folded SequenceExprs that have not been removed from the AST.

To avoid a double visit, track whether a SequenceExpr is folded and then
customize how ASTVisitor handles folded sequences.

Resolves rdar://142824799 and swiftlang#78567.
@tshortli tshortli marked this pull request as ready for review January 17, 2025 20:39
@tshortli tshortli requested a review from a team as a code owner January 17, 2025 20:39
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli enabled auto-merge January 17, 2025 23:16
@tshortli tshortli linked an issue Jan 17, 2025 that may be closed by this pull request
@tshortli tshortli added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.1-dev labels Jan 18, 2025
@tshortli
Copy link
Contributor Author

@swift-ci please test macOS

@tshortli tshortli merged commit 1ac9fd8 into swiftlang:release/6.1 Jan 19, 2025
5 checks passed
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 swift 6.1-dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler crash with message "overlapping children"
2 participants