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

[SR-5454] Malformed #keyPath(…) on NSObject subclass segfaults compiler #48026

Closed
tkrajacic opened this issue Jul 14, 2017 · 3 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@tkrajacic
Copy link

Previous ID SR-5454
Radar None
Original Reporter @tkrajacic
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

Xcode 9b3

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee @xedin
Priority Medium

md5: e39f42df7eafac641a80d20d1921c74d

Issue Description:

When having a malformed #keyPath(…) the compiler usually gives an error but if it is on an NSObject subclass it segfaults.

import Foundation
// Remove NSObject inheritance and it doesn't crash
class Muppet: NSObject {
    var identifier: String = "Kermit"
    
    static func predicateForIdentifier(_ id: String) -> NSPredicate {
        return NSPredicate(format: "%K = %@", #keyPath(Self.identifier), id)
    }
}

Attached is an example project for quick checking

@belkadan
Copy link
Contributor

No longer crashes on master. @jckarter, @xedin, did this get fixed recently?

@xedin
Copy link
Member

xedin commented Jul 14, 2017

Has been fixed by #10909 @tkrajacic please validate when the latest nightly.

@tkrajacic
Copy link
Author

Tested with Xcode 10 and Swift 4.2 and this is fixed

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

4 participants