mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
31 lines
366 B
Swift
31 lines
366 B
Swift
// RUN: %target-swift-frontend %s -emit-ir
|
|
|
|
protocol P {
|
|
associatedtype A
|
|
func f()
|
|
}
|
|
|
|
extension P where A == Int {
|
|
func f() {
|
|
print("cool")
|
|
}
|
|
}
|
|
extension P {
|
|
func f() { print("semi-uncool") }
|
|
func g() {
|
|
f()
|
|
}
|
|
}
|
|
struct X<T> : P {
|
|
typealias A = T
|
|
}
|
|
|
|
extension X where A == Int {
|
|
func f() {
|
|
print("cool2")
|
|
}
|
|
}
|
|
|
|
X<Int>().f()
|
|
X<Int>().g()
|