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-9469] 'read' and 'modify' accessors are not allowed to be marked @objc #51931

Closed
ChristopherRogers opened this issue Dec 11, 2018 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 5.0

Comments

@ChristopherRogers
Copy link
Contributor

Previous ID SR-9469
Radar rdar://problem/46699152
Original Reporter @ChristopherRogers
Type Bug
Status Closed
Resolution Done
Environment

Swift 5.0, master branch (71c11b7)

macOS 10.14.2

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 5.0Regression
Assignee None
Priority Medium

md5: 6a091a93ec93f0cd96cc7cd9121fdf2d

Issue Description:

The following code fails to compile on the master branch with the error, "'read' and 'modify' accessors are not allowed to be marked @objc". It will compile if you remove the setter or the @objc attribute on the extension. (You can leave the @objc attribute on the static variable declaration.)

import Foundation

@objc class MyObjCClass: NSObject {}

@objc
extension MyObjCClass {
    @objc
    static var objCVarInObjCExtension: Bool {
        get {
            return true
        }
        set {}
    }
}
@belkadan
Copy link
Contributor

cc @rjmccall. We probably just shouldn't infer @objc from context for accessors?

@rjmccall
Copy link
Member

At least not for read and modify, and yeah, I don't know how generally meaningful `@objc` is for accessors.

@belkadan
Copy link
Contributor

Well, it's important if you want to rename them, but for inferring the attribute you can usually do it from the property or subscript.

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Jul 23, 2019

Has been addressed by #21657

@ChristopherRogers, Could you verify if the problem is fixed and if so move the JIRA to "Closed"?

Thanks!
Anna

@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. compiler The Swift compiler in itself regression swift 5.0
Projects
None yet
Development

No branches or pull requests

4 participants