Nullability specifier on int when generating Objective-C header for Swift code

Originator:alejandro.isaza
Number:rdar://43347303 Date Originated:August 15, 2018
Status: Resolved:
Product:Developer Tools Product Version:Version 10.0 beta 6 (10L232m)
Classification: Reproducible:Yes
 
Summary:

When building a Swift project in Xcode 10b6 that contains a class inheriting from NSObject with an @objc int computed property, the generated Project-Swift.h file contains a nullability specifier for that int property.

Steps to Reproduce:

See attached project

Expected Results:

There is no nullability specified for the int property

Actual Results:

There is a nullability specified, trying to use the framework results in:

error: nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'

Version/Build:

Version 10.0 beta 6 (10L232m)

Comments

Crash on Xcode

0 swift 0x00000001128a037a PrintStackTraceSignalHandler(void*) + 42 1 swift 0x000000011289fb2e SignalHandler(int) + 302 2 libsystem_platform.dylib 0x00007fff5d5e7f5a sigtramp + 26 3 libsystemplatform.dylib 0x00007ffee1125b50 _sigtramp + 2209602576 4 swift 0x000000010f924d76 swift::TypeVisitor<(anonymous namespace)::ObjCPrinter, void, llvm::Optional >::visit(swift::Type, llvm::Optional) + 230 5 swift 0x000000010f91f7b5 (anonymous namespace)::ObjCPrinter::print(swift::Type, llvm::Optional, swift::Identifier, (anonymous namespace)::IsFunctionParam_t) + 629 6 swift 0x000000010f9220e9 (anonymous namespace)::ObjCPrinter::visitVarDecl(swift::VarDecl*) + 4617 7 swift 0x000000010f920e8d void (anonymous namespace)::ObjCPrinter::printMembers<false, swift::IteratorRange >(swift::IteratorRange&&) + 461 8 swift 0x000000010f91d845 swift::ASTVisitor<(anonymous namespace)::ObjCPrinter, void, void, void, void, void, void>::visit(swift::Decl) + 4133 9 swift 0x000000010eb6cb94 printAsObjCIfNeeded(llvm::StringRef, swift::ModuleDecl, llvm::StringRef, bool) + 6132 10 swift 0x000000010eb63f72 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef, int&, swift::FrontendObserver, swift::UnifiedStatsReporter) + 39522 11 swift 0x000000010eb57015 swift::performFrontend(llvm::ArrayRef, char const*, void, swift::FrontendObserver) + 7717 12 swift 0x000000010eafcc95 main + 1349 13 libdyld.dylib 0x00007fff5d2d9015 start + 1 14 libdyld.dylib 0x0000000000000042 start + 2731700270

By alejandro.isaza at Aug. 15, 2018, 10:23 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!