mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When SILGen maps the subscript indices used in a keypath out of context, also map the conformance to Hashable. Fixes rdar://problem/46632723.
18 lines
462 B
Swift
18 lines
462 B
Swift
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
|
|
|
|
// rdar://problem/46632723
|
|
public struct Foo<T>: Hashable { }
|
|
|
|
public struct Bar<U, V> {
|
|
public subscript<W> (foo: W) -> Int {
|
|
return 0
|
|
}
|
|
|
|
// CHECK-LABEL: define {{.*}} @"$s17keypath_subscript3FooVyqd__Gr0__lTh"
|
|
// CHECK: call swiftcc %swift.metadata_response @"$s17keypath_subscript3FooVMa"
|
|
public func blah<W>(_: W) -> AnyKeyPath {
|
|
return \Bar<U, V>.[Foo<W>()] as AnyKeyPath
|
|
}
|
|
}
|
|
|