You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
... the Swift Compiler would normally generate a Swift function like:
func transaction(for transactionData: Data) -> Data
But, if this Objective C method was auto-created by the Objective C compiler due to an Objective C class Bar's header declaring an implementing an @objc Swift protocol Fooy in another module Foo with a function name like:
... without actually listing the implementation for it ...
... and if that Bar also inherits from FBSnapshotTestCase ...
... and if there is yet another module Qux in which another class Qux inherits from that Bar, and then if MocQux inherits from Qux, and declares its own local implementations of the Foo protocol methods...
I've edited the title to be shorter and hopefully easier to follow. I understand why you'd want to explain the whole thing, but I think a very long title is difficult to grasp. The problem description + code do provide details.
(Please feel free to re-edit the title if you think the re-wording is inaccurate.)
xy (JIRA User) I've reproduced this locally with Xcode 12's compiler, but the prepackaged version of FBSnapshotTestCase.framework in your reproducer can't be loaded by newer compilers with assertions enabled, which makes it hard to debug. Can you provide the configuration (I'm guessing a Cartfile?) needed to rebuild FBSnapshotTestCase.framework?
Additional Detail from JIRA
md5: 5c50f1e1acbee2bf3029406aaf11ec8a
Issue Description:
Given an Objective C method like:
... the Swift Compiler would normally generate a Swift function like:
func transaction(for transactionData: Data) -> Data
But, if this Objective C method was auto-created by the Objective C compiler due to an Objective C class Bar's header declaring an implementing an @objc Swift protocol Fooy in another module Foo with a function name like:
@objc func transactionForTransactionData(_ data: NSData) -> NSData
... without actually listing the implementation for it ...
... and if that Bar also inherits from FBSnapshotTestCase ...
... and if there is yet another module Qux in which another class Qux inherits from that Bar, and then if MocQux inherits from Qux, and declares its own local implementations of the Foo protocol methods...
then we get Segmentation Fault 11.
See sample project and README for instructions: https://github.com/1oo7/segfault11.git
Stacktrace:
1. Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)
2. While looking for 'myNavigationController'3. While ...in 'REDACTED' (in module 'REDACTED')
4. /Users/REDACTED/Build/Products/Testing-iphonesimulator/REDACTED.framework/Headers/REDACTED-Swift.h:1375:76: importing 'MyProtocol::myNavigationController'
0 swift 0x000000010e300865 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1 swift 0x000000010e2ff865 llvm::sys::RunSignalHandlers() + 85
2 swift 0x000000010e300e1f SignalHandler(int) + 111
3 libsystem_platform.dylib 0x00007fff704165fd _sigtramp + 29
4 libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338632829472
5 swift 0x000000010ae70003 (anonymous namespace)::SwiftDeclConverter::VisitObjCPropertyDecl(clang::ObjCPropertyDecl const*) + 259
6 swift 0x000000010ae588db swift::ClangImporter::Implementation::importDeclAndCacheImpl(clang::NamedDecl const*, swift::importer::ImportNameVersion, bool, bool) + 1483
7 swift 0x000000010ae42972 swift::ClangImporter::loadObjCMethods(swift::ClassDecl*, swift::ObjCSelector, bool, unsigned int, llvm::TinyPtrVector<swift::AbstractFunctionDecl*>&) + 258
8 swift 0x000000010afad19d swift::ASTContext::loadObjCMethods(swift::ClassDecl*, swift::ObjCSelector, bool, unsigned int, llvm::TinyPtrVector<swift::AbstractFunctionDecl*>&) + 301
9 swift 0x000000010b17f8e4 swift::ClassDecl::lookupDirect(swift::ObjCSelector, bool) + 180
10 swift 0x000000010ad47a36 lookupObjCMethodInClass(swift::ClassDecl*, swift::ObjCSelector, bool, bool, swift::SourceManager&, bool) + 54
11 swift 0x000000010ad47440 swift::diagnoseUnintendedObjCMethodOverrides(swift::SourceFile&) + 944
12 swift 0x000000010ae290da swift::performWholeModuleTypeChecking(swift::SourceFile&) + 250
13 swift 0x0000000109fa3abd swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 8237
14 swift 0x0000000109e642fd swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6845
15 swift 0x0000000109de8c07 main + 1255
16 libdyld.dylib 0x00007fff7021dcc9 start + 1
17 libdyld.dylib 0x0000000000000099 start + 18446603338634896337
error: Segmentation fault: 11 (in target 'REDACTEDTests' from project 'REDACTED')
The text was updated successfully, but these errors were encountered: