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-5025] Swift 4.0: Crash because "missing diags for other accessors" in @objc extensions #47601

Closed
swift-ci opened this issue May 26, 2017 · 2 comments
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

@swift-ci
Copy link
Collaborator

Previous ID SR-5025
Radar rdar://problem/32426538
Original Reporter VictorPimentel (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

macOS Sierra 10.12.5
Xcode 8.3.2
Toolchain: Swift 4.0 Snapshot 2017-05-17 (a)

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: e5b606fbbb3e81f9594ec46b8fccd9d9

is duplicated by:

relates to:

Issue Description:

When using a toolchain from the swift-4.0-branch the compiler crashes with this code:

import Foundation

class User: NSObject {
}

@objc extension User {
    var name: String {
        get {
            return "No name"
        }
        set {
            // Nothing
        }
    }
}

The compiler crashes because of an assertion:

Stack dump:
0.  While type-checking extension of User at /var/folders/lk/wf8805dn77s3hjyqm399tnqc0000gp/T/playground1-cc22d8..swift:14:7
1.  While type-checking declaration 0x7f96fe396f40 at /var/folders/lk/wf8805dn77s3hjyqm399tnqc0000gp/T/playground1-cc22d8..swift:15:2
2.  While validating 'name' at /var/folders/lk/wf8805dn77s3hjyqm399tnqc0000gp/T/playground1-cc22d8..swift:15:6
3.  While validating materializeForSet for name at /var/folders/lk/wf8805dn77s3hjyqm399tnqc0000gp/T/playground1-cc22d8..swift:15:6
4.  While type-checking materializeForSet for name at /var/folders/lk/wf8805dn77s3hjyqm399tnqc0000gp/T/playground1-cc22d8..swift:15:6
 
Assertion failed: (FD->isGetterOrSetter() && "missing diags for other accessors"), function isRepresentableInObjC, file /Users/buildnode/jenkins/workspace/oss-swift-4.0-package-osx/swift/lib/Sema/TypeCheckType.cpp, line 3558.

It seems that the assert checks for getters or setters and the thing that is being typechecked is a "materializeForSet". If you remove the @objc or if you remove the setter, the compiler doesn't crash. If you move the @objc to the var it also doesn't crash.

Full crash report of a playground with that code is attached.

@belkadan
Copy link
Contributor

Really thought we fixed this one. Thanks.

@swift-ci create

@DougGregor
Copy link
Member

d067b63

@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