Files
swift-mirror/test/IRGen/keypath_subscript.swift
Doug Gregor 0a2e7265db [Key paths] Map Hashable conformances for subscript indexes out of context.
When SILGen maps the subscript indices used in a keypath out of context,
also map the conformance to Hashable. Fixes rdar://problem/46632723.
2018-12-12 14:25:09 -08:00

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
}
}