-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself
Description
Previous ID | SR-6184 |
Radar | None |
Original Reporter | 100mango (JIRA User) |
Type | Bug |
Environment
Xcode 9.0
Swift4
Additional Detail from JIRA
Votes | 1 |
Component/s | Compiler |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 0bf8e790977c4215c3710b9e3a95f618
Issue Description:
extension MyProtocol {
func log()
}
extension MyProtocol {
func log() {
print("MyProtocol default implementation")
}
}
class MyGenericClass<T> : MyProtocol {
let t: T
init(_ t: T) {self.t = t}
}
extension MyProtocol where Self==MyGenericClass<Int> {
func log() {
print("MyProtocol where MyGenericClass<Int>")
}
}
func logByProtocol(_ p: MyProtocol) {
p.log()
}
let myGenericClassNumber = MyGenericClass(1)
let myGenericClassString = MyGenericClass("1")
myGenericClassNumber.log()//expect "MyGenericClass<Int>" true
myGenericClassString.log()//expect "MyProtocol default implementation" true
logByProtocol(myGenericClassNumber)//expect "MyGenericClass<Int>", But print "MyProtocol default implementation" wrong
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself