Skip to content

[5.5][SILGen] Fix a crash when a wrapped property initial value has a re-abstractable type. #37982

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

Conversation

hborla
Copy link
Member

@hborla hborla commented Jun 17, 2021

Cherry-pick of #37936

  • Explanation: For stored property initialization, SILGen will emit the initialization result into a converting initialization if the initialization result and the original property type have different abstraction levels (SILGen: Fix crash when a stored property with an initial value has a reabstractable type #34255). This code assumed that the initial value of the member and the result of initialization are the same type. This isn't true for property wrappers because the initial value can be the wrapped value type, but the result is always the property wrapper type, so this case would crash in SILGen. Property wrapper types are never reabstractable types anyway, so the converting initialization isn't necessary.
  • Scope: Limited to property wrappers; the change is to opt out of the converting initialization if the member is a property wrapper.
  • Risk: Low.
  • Testing: Added a test case to the suite.
  • Reviewer: @slavapestov

Resolves: rdar://77339559

initializers if the member is a property wrapper.

This code assumes that the initial value of the member and the result
of initialization are the same type (but differing in abstraction level).
This isn't true for property wrappers because the initial value can be
the wrapped value type, but the result is always the property wrapper
type. Property wrapper types are never reabstractable types anyway, so
the converting initialization isn't necessary.
@hborla hborla requested a review from a team as a code owner June 17, 2021 23:19
@hborla
Copy link
Member Author

hborla commented Jun 17, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - f9afa5a

@tkremenek
Copy link
Member

@swift-ci clean test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - f9afa5a

@hborla
Copy link
Member Author

hborla commented Jun 22, 2021

@swift-ci please test macOS platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - f9afa5a

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - f9afa5a

@hborla
Copy link
Member Author

hborla commented Jun 22, 2021

@swift-ci please test macOS platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - f9afa5a

@hborla
Copy link
Member Author

hborla commented Jun 22, 2021

@swift-ci please test macOS platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - f9afa5a

@hborla
Copy link
Member Author

hborla commented Jun 23, 2021

17:37:11 Testing failed:
17:37:11 PlaygroundLoggerTests_macOS:
17:37:11 The test runner encountered an error (Failed to establish communication with the test runner. If you believe this error represents a bug, please attach the result bundle at /Users/buildnode/jenkins/workspace/swift-PR-macos/branch-release/5.5/buildbot_incremental/playgroundsupport-macosx-x86_64/DerivedData/Logs/Test/Test-BuildScript-Test-PlaygroundLogger-macOS-2021.06.22_17-36-44--0700.xcresult. (Underlying Error: Couldn’t communicate with a helper application. Try your operation again. If that fails, quit and relaunch the application and try again. The connection to service on pid 0 named com.apple.testmanagerd.control was invalidated.))

Looks like this is blocking a bunch of other release/5.5 PRs as well.

@hborla hborla added the r5.5 label Jun 23, 2021
@hborla
Copy link
Member Author

hborla commented Jun 23, 2021

Test is disabled: #38057

@swift-ci please test macOS platform

@hborla hborla merged commit 6c71b0c into swiftlang:release/5.5 Jun 23, 2021
@hborla hborla deleted the 5.5-reabstractable-wrapped-value branch June 23, 2021 23:56
@AnthonyLatsis AnthonyLatsis added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.5 labels Jan 8, 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 swift 5.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants