mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Added more tests (related to generic tuples)
This commit is contained in:
committed by
Andrea Tomarelli
parent
b0e424f469
commit
1577afee80
@@ -422,3 +422,17 @@ func tuples(_: T) {
|
||||
// CHECK: keypath $KeyPath<T, String>, (root $T; stored_property #T.c : $(x: C<Int>, y: C<String>); tuple_element #0 : $C<Int>; stored_property #C.y : $String)
|
||||
let _: KeyPath<T, String> = \T.c.x.y
|
||||
}
|
||||
|
||||
// CHECK-LABEL: sil hidden @{{.*}}tuples_generic
|
||||
func tuples_generic<T, U, V>(_: T, _: U, _: V) {
|
||||
typealias TUC = (T, U, C<V>)
|
||||
|
||||
// CHECK: keypath $WritableKeyPath<(T, U, C<V>), T>, <τ_0_0, τ_0_1, τ_0_2> (root $(τ_0_0, τ_0_1, C<τ_0_2>); tuple_element #0 : $τ_0_0) <T, U, V>
|
||||
let _: WritableKeyPath<TUC, T> = \TUC.0
|
||||
// CHECK: keypath $WritableKeyPath<(T, U, C<V>), U>, <τ_0_0, τ_0_1, τ_0_2> (root $(τ_0_0, τ_0_1, C<τ_0_2>); tuple_element #1 : $τ_0_1) <T, U, V>
|
||||
let _: WritableKeyPath<TUC, U> = \TUC.1
|
||||
// CHECK: keypath $ReferenceWritableKeyPath<(T, U, C<V>), V>, <τ_0_0, τ_0_1, τ_0_2> (root $(τ_0_0, τ_0_1, C<τ_0_2>); tuple_element #2 : $C<τ_0_2>; stored_property #C.x : $τ_0_2) <T, U, V>
|
||||
let _: ReferenceWritableKeyPath<TUC, V> = \TUC.2.x
|
||||
// CHECK: keypath $KeyPath<(T, U, C<V>), String>, <τ_0_0, τ_0_1, τ_0_2> (root $(τ_0_0, τ_0_1, C<τ_0_2>); tuple_element #2 : $C<τ_0_2>; stored_property #C.y : $String) <T, U, V>
|
||||
let _: KeyPath<TUC, String> = \TUC.2.y
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user