Skip to content

[PrintAsObjC] Fix class properties with generic parameters. #3092

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

Conversation

jrose-apple
Copy link
Contributor

  • Explanation: Commas in ObjC generics break our compatibility macro used for ObjC class properties, just like they would with C++ templates in macros. Fix this by making the macro variadic.
  • Scope: Only affects class properties exposed to Objective-C. Should not change the behavior of anything that previously worked, either.
  • Issue: rdar://problem/26879147.
  • Risk: Very low. It's a very simple change with fairly limited scope.
  • Testing: Added compiler regression tests.

Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
All supported platforms @swift-ci Please smoke test and merge
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
All supported platforms @swift-ci Please test and merge
OS X platform @swift-ci Please test OS X platform
OS X platform @swift-ci Please benchmark
Linux platform @swift-ci Please test Linux platform

Lint Testing

Language Comment
Python @swift-ci Please Python lint

Note: Only members of the Apple organization can trigger swift-ci.

    public static var myDictionary: [String: AnyObject]

becomes

    SWIFT_CLASS_PROPERTY(@Property (nonatomic, class, readonly, copy)
      NSDictionary<NSString *, id> * _Nonnull myDictionary;)

and the commas in the ObjC generic break the macro, just like they do with
C++ templates. Fix this by making the macro variadic.

rdar://problem/26879147
(cherry picked from commit a679aca)
@jrose-apple jrose-apple added this to the Swift 3.0 Preview 2 milestone Jun 20, 2016
@jrose-apple
Copy link
Contributor Author

@DougGregor, mind reviewing for the branch?

@swift-ci Please test

@tkremenek
Copy link
Member

@swift-ci test

@tkremenek tkremenek merged commit b4901ea into swiftlang:swift-3.0-preview-2-branch Jun 21, 2016
@jrose-apple jrose-apple deleted the swift-3-objc-class-properties branch June 21, 2016 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants