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
[SR-12425] Swift 5.2 Regression: Segfault when type of dynamic member key path doesn't match instance type #54864
Comments
I guess I should clarify: the code is incorrect. Swift 5.1.3 diagnoses it, while Swift 5.2 segfaults. Here's the output for Swift 5.1.3: /Users/username/Desktop/SampleProject/Utilities/SegfaultingThings.swift:5:1: error: @dynamicMemberLookup attribute requires 'RightStruct' to have a 'subscript(dynamicMember:)' method that accepts either 'ExpressibleByStringLiteral' or a keypath
@dynamicMemberLookup
^
/Users/username/Desktop/SampleProject/Utilities/SegfaultingThings.swift:18:34: error: incorrect argument label in subscript (have 'keyPath:', expected 'dynamicMember:')
get { rightStructInstance[keyPath: member] }
^~~~~~~~
dynamicMember
/Users/username/Desktop/SampleProject/Utilities/SegfaultingThings.swift:19:34: error: cannot assign through subscript: 'rightStructInstance' is immutable
set { rightStructInstance[keyPath: member] = newValue } |
On master:
|
@swift-ci create |
@ZevEisenberg Can you please verify in the next master snapshot and close? 🙂 Thanks |
Confirmed fixed in: Apple Swift version 5.4 (swiftlang-1205.0.16.12 clang-1205.0.19.6) Target: arm64-apple-darwin20.3.0 (And probably earlier, but I'm bad at email.) |
Attachment: Download
Environment
Xcode 11.4 (11E146) on macOS 10.15.4 (19E266)
Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)
Target: x86_64-apple-darwin19.4.0
Additional Detail from JIRA
md5: 5ebe8cb4b3c692d76e9a3f700fc80df6
is duplicated by:
Issue Description:
This is a Swift 5.2 regression. It does not happen on Swift 5.1.3.
The text was updated successfully, but these errors were encountered: