Created
February 17, 2017 15:10
-
-
Save tarunon/d7071689ab55e29bd367a44833687aa3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
protocol A { | |
associatedtype X | |
func hoge(_ arg: X) | |
} | |
extension A where X == Void { | |
func hoge(_ arg: Void) { | |
} | |
} | |
class B: A { | |
} |
スコープ区切ってあげると where句完全無視説が崩れそう(´・ω・`)?
// file1.swift
protocol A {
associatedtype X
func hoge(_ arg: X)
}
extension A /* where X == Void */ {
func hoge(_ arg: Void) {
}
}
class B: A {}
// file2.swift
private protocol P {}
extension A where Self: P {
func hoge(_ arg: Int) {
print(#function, #line)
}
}
private struct C: A, P {
}
デフォルト実装が増えた場合は死ぬだろうと予想してましたが、ファイルを分割すれば通る…ウーン…
でもこれX==Voidを起こすとCは死にますね
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
where句を無視して全ての型に
func hoge(_ arg:Void)
が生えていると仮定することでB.X==Void
が決定できるのではないか説 by @ezura