Files
swift-mirror/test/IRGen/protocol_extensions_constrain.swift
Slava Pestov 9cff70a00a More robust IRGen tests
Fixes <rdar://problem/20812052>

Swift SVN r28197
2015-05-06 04:04:42 +00:00

41 lines
670 B
Swift

// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
// rdar://20532214 -- Wrong code for witness method lookup lets executable crash
public protocol P1 {
func foo(rhs: Self) -> Bool
}
public protocol P2 {
typealias Index : P1
var startIndex: Index {get}
}
public protocol P3 : P1 {}
public struct C3 : P3 {
public func foo(rhs: C3) -> Bool {
return true
}
}
public struct C2 : P2 {
public var startIndex: C3 {
return C3()
}
}
extension P2 where Self.Index : P3 {
final public var bar: Bool {
let i = startIndex
return i.foo(i)
}
}
let s = C2()
s.bar
// CHECK: call {{.*}} @_TWPV29protocol_extensions_constrain2C3S_2P3S_