Last active
August 29, 2015 14:26
-
-
Save josephlord/afc60fcb94292956959e to your computer and use it in GitHub Desktop.
Extending [String:T] - Compiles but fails at linking radar raised rdar://22028034
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public protocol StringyType { | |
var string:String { get } | |
init(_ string:String) | |
} | |
extension String : StringyType { | |
public var string:String{ return self } | |
public init(_ string:String) { | |
self = string | |
} | |
} | |
public protocol DictionaryType { | |
typealias Key | |
typealias Value | |
typealias Element = (Key, Value) | |
subscript(key: Key) -> Value? { get set } | |
} | |
extension DictionaryType where Key:StringyType { | |
public var one:Value? { | |
return self[Key("One")] | |
} | |
} | |
// This is the line that actually triggers the linker failure. Accidentally ommittted from original verison of Gist. | |
extension Dictionary : DictionaryType {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Undefined symbols for architecture x86_64: | |
"__TFVSs10Dictionarym9subscriptFq_GSqq0__", referenced from: | |
__TTWu0_Rq_Ss8Hashable_GVSs10Dictionaryq_q0__18DictionaryProtocol14DictionaryTypeS1_FS2_m9subscriptFqq_S2_3KeyGSqqq_S2_5Value_ in DictionaryProtocol-417391.o | |
ld: symbol(s) not found for architecture x86_64 | |
<unknown>:0: error: linker command failed with exit code 1 (use -v to see invocation) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment