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-10338] Swift 5 regression: initializing NSObject returns wrong instance #52738

Closed
swift-ci opened this issue Apr 8, 2019 · 0 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Apr 8, 2019

Previous ID SR-10338
Radar None
Original Reporter Leitch (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

Xcode 10.2 (10E125)

Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
Target: x86_64-apple-darwin18.5.0

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: a36faca35693f268b6a7bf66618ce691

duplicates:

  • SR-10285 Subclass of a class that conforms to a protocol and extends NSObject is not instantiate correctly

Issue Description:

import Cocoa

protocol SwiftInitializeable {
    init()
}

class MyBaseclass: NSObject, SwiftInitializeable {
    required override init() {
        super.init()
    }
}

class MySubclass: MyBaseclass {}

let type: SwiftInitializeable.Type = MySubclass.self
let cls = type.init()

print(cls)

In Xcode 10.1, Swift 4.2 this outputs:

<__lldb_expr_3.MySubclass: 0x7fa617e4df10>

However in Xcode 10.2, both Swift 5 & 4.2 mode it outputs:

<__lldb_expr_1.MyBaseclass: 0x7fa449462aa0>
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 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.
Projects
None yet
Development

No branches or pull requests

1 participant