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-8217] Generated ObjC header contains syntax errors with certain declarations #50749

Closed
swift-ci opened this issue Jul 10, 2018 · 0 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

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

Swift 4.2

Xcode Version 10.0 beta 3 (10L201y)

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

md5: 41562f2af56314045f02fb3b5fba1849

duplicates:

  • SR-2250 Generated ObjC header doesn't import Foundation if only bridged types are used

Issue Description:

The generated ObjC header for a static class property, declared as

@objc public class TestClass: NSObject {

    @objc public private(set) static var test = [Int]()

}

fails to build, with errors

error: unknown type name 'NSArray'
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSArray<NSNumber *> * _Nonnull test;)
                                                                  ^
error: expected member name or ';' after declaration specifiers
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSArray<NSNumber *> * _Nonnull test;)
                                                                  ~~~~~~~^
note: expanded from macro 'SWIFT_CLASS_PROPERTY'
#  define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
                                    ^~~~~~~~~~~
error: property requires fields to be named
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSArray<NSNumber *> * _Nonnull test;)
                     ^                                            ~~~~~~~
note: expanded from macro 'SWIFT_CLASS_PROPERTY'
#  define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
                                    ^~~~~~~~~~~
: error: expected ';' at end of declaration list
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSArray<NSNumber *> * _Nonnull test;)
                                                                         ^
error: expected '>'
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSArray<NSNumber *> * _Nonnull test;)
                                                                                   ^
warning: protocol has no object type specified; defaults to qualified 'id'
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSArray<NSNumber *> * _Nonnull test;)
                                                                         ^
                                                                         id
note: expanded from macro 'SWIFT_CLASS_PROPERTY'
#  define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
                                    ^
error: expected identifier or '('
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSArray<NSNumber *> * _Nonnull test;)
                                                                                    ^
expected a type
+ (NSArray<NSNumber *> * _Nonnull)test SWIFT_WARN_UNUSED_RESULT;
   ^
1 warning and 7 errors generated.
@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
Projects
None yet
Development

No branches or pull requests

1 participant