这段代码示例打破了
Swift编译器:
import Foundation @objc protocol Some { associatedtype W } extension Some { func takeW(w: W) -> Void { } }
输出:
0 swift 0x0000000104f583ad PrintStackTraceSignalHandler(void*) + 45 1 swift 0x0000000104f57b56 SignalHandler(int) + 790 2 libsystem_platform.dylib 0x00007fffe7eadbba _sigtramp + 26 3 libsystem_malloc.dylib 0x00007fffe7e21258 malloc + 24 4 swift 0x0000000101f8cd32 llvm::Value* llvm::function_ref<llvm::Value* (unsigned int)>::callback_fn<swift::irgen::emitArchetypeWitnessTableRef(swift::irgen::IRGenFunction&,swift::CanTypeWrapper<swift::ArchetypeType>,swift::ProtocolDecl*)::$_0>(long,unsigned int) + 530 ... While emitting IR SIL function @_TFE4mainPS_4Some5takeWfT1wwx1W_T_ for 'takeW' at main.swift:11:5
混合@objc和associatedtype本质上是错误的,还是普通的编译器错误?
swiftc --version Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1) Target: x86_64-apple-macosx10.9