Skip to content

Commit 66ec988

Browse files
technicatedToma91
authored andcommitted
---
yaml --- r: 278265 b: refs/heads/swift-5.1-old-llvm-branch c: d7324b9 h: refs/heads/master i: 278263: 876d293
1 parent 27e5822 commit 66ec988

File tree

10 files changed

+262
-12
lines changed

10 files changed

+262
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-01-24-a: b6f62823aa5010b2ae53f15f72a57
12411241
refs/heads/marcrasi-astverifier-disable: 3fac766a23a77ebd0640296bfd7fc116ea60a4e0
12421242
refs/heads/revert-22227-a-tall-white-fountain-played: adfce60b2eaa54903ea189bed8a783bca609fa53
12431243
refs/heads/revert-22300-revert-22227-a-tall-white-fountain-played: 5f92040224df7dd4e618fdfb367349df64d8acad
1244-
refs/heads/swift-5.1-old-llvm-branch: a0ed29d32611e52704af29242b3f8b22e45f63e7
1244+
refs/heads/swift-5.1-old-llvm-branch: d7324b977e8b8daeb27ad1c8971eb4a79b938fb8
12451245
refs/heads/swift-5.1-branch: 8060872acb4105d9655e020fe047e1ebcd77d0fb
12461246
refs/tags/swift-4.2.2-RELEASE: e429d1f1aaf59e69d38207a96e56265c7f6fccec
12471247
refs/tags/swift-5.0-DEVELOPMENT-SNAPSHOT-2019-02-02-a: 3e5a03d32ff3b1e9af90d6c1198c14f938379a6e

branches/swift-5.1-old-llvm-branch/lib/IDE/SourceEntityWalker.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,7 @@ std::pair<bool, Expr *> SemaAnnotator::walkToExprPre(Expr *E) {
361361
break;
362362
}
363363

364-
case KeyPathExpr::Component::Kind::TupleElement: {
365-
llvm_unreachable("[technicated]");
366-
break;
367-
}
368-
364+
case KeyPathExpr::Component::Kind::TupleElement:
369365
case KeyPathExpr::Component::Kind::Invalid:
370366
case KeyPathExpr::Component::Kind::UnresolvedProperty:
371367
case KeyPathExpr::Component::Kind::UnresolvedSubscript:

branches/swift-5.1-old-llvm-branch/lib/SIL/SILVerifier.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,18 @@ void verifyKeyPathComponent(SILModule &M,
389389
"invalid baseTy, should have been a TupleType");
390390

391391
auto tupleTy = loweredBaseTy.getAs<TupleType>();
392-
393-
require(component.getTupleIndex() < tupleTy->getNumElements(),
392+
auto eltIdx = component.getTupleIndex();
393+
394+
require(eltIdx < tupleTy->getNumElements(),
394395
"invalid element index, greater than # of tuple elements");
395396

397+
auto eltTy = tupleTy->getElementType(eltIdx)
398+
->getReferenceStorageReferent()
399+
->getCanonicalType();
400+
401+
require(eltTy == componentTy,
402+
"tuple element type should match the type of the component");
403+
396404
break;
397405
}
398406
}

branches/swift-5.1-old-llvm-branch/lib/Sema/CSGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3049,7 +3049,7 @@ namespace {
30493049
}
30503050

30513051
case KeyPathExpr::Component::Kind::TupleElement: {
3052-
llvm_unreachable("[technicated]");
3052+
llvm_unreachable("not implemented");
30533053
break;
30543054
}
30553055

branches/swift-5.1-old-llvm-branch/lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4334,7 +4334,7 @@ ConstraintSystem::simplifyKeyPathConstraint(Type keyPathTy,
43344334
break;
43354335

43364336
case KeyPathExpr::Component::Kind::TupleElement:
4337-
llvm_unreachable("[technicated]");
4337+
llvm_unreachable("not implemented");
43384338
break;
43394339
}
43404340
}

branches/swift-5.1-old-llvm-branch/test/IRGen/keypaths.sil

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ public class C2: C1 {
3838
public var reabstracted: () -> ()
3939
}
4040

41+
public struct T {
42+
public var a: (Int, String)
43+
public let b: (String, Int)
44+
public var c: (f: Int, g: String)
45+
public let d: (x: String, y: Int)
46+
}
47+
4148
sil_vtable C {}
4249
sil_vtable C1 {}
4350
sil_vtable C2 {}
@@ -180,6 +187,121 @@ sil_vtable C2 {}
180187
// looping in the compiler at one point.
181188
// CHECK: [[KP_M:@keypath.*]] = private global <{ {{.*}} }> <{
182189

190+
// -- %t0: T.a.0
191+
// CHECK: [[KP_T0:@keypath(\..*)?]] = private global <{ {{.*}} }> <{
192+
// CHECK-SAME: [[WORD]]* @keypath_once
193+
// CHECK-SAME: @"symbolic
194+
// CHECK-SAME: @"symbolic
195+
// -- instantiable in-line, size 12
196+
// CHECK-SAME: <i32 0x8000_000c>,
197+
// -- offset of T.a, mutable
198+
// CHECK-SAME: <i32 0x0180_0000>,
199+
// CHECK: @"symbolic
200+
// -- tuple element #0 of T.a
201+
// CHECK-SAME: <i32 0x0180_0000> }>
202+
203+
// -- %t1: T.a.1
204+
// CHECK: [[KP_T1:@keypath(\..*)?]] = private global <{ {{.*}} }> <{
205+
// CHECK-SAME: [[WORD]]* @keypath_once
206+
// CHECK-SAME: @"symbolic
207+
// CHECK-SAME: @"symbolic
208+
// -- instantiable in-line, size 12
209+
// CHECK-SAME: <i32 0x8000_000c>,
210+
// -- offset of T.a, mutable
211+
// CHECK-SAME: <i32 0x0180_0000>,
212+
// CHECK: @"symbolic
213+
// -- tuple element #1 of T.a
214+
// CHECK-32-SAME: <i32 0x0180_0004> }>
215+
// CHECK-64-SAME: <i32 0x0180_0008> }>
216+
217+
// -- %t2: T.b.0
218+
// CHECK: [[KP_T2:@keypath(\..*)?]] = private global <{ {{.*}} }> <{
219+
// CHECK-SAME: [[WORD]]* @keypath_once
220+
// CHECK-SAME: @"symbolic
221+
// CHECK-SAME: @"symbolic
222+
// -- instantiable in-line, size 12
223+
// CHECK-SAME: <i32 0x8000_000c>,
224+
// -- offset of T.b
225+
// CHECK-32-SAME: <i32 0x0100_000c>,
226+
// CHECK-64-SAME: <i32 0x0100_0018>,
227+
// CHECK: @"symbolic
228+
// -- tuple element #0 of T.b
229+
// CHECK-SAME: <i32 0x0180_0000> }>
230+
231+
// -- %t3: T.b.1
232+
// CHECK: [[KP_T3:@keypath(\..*)?]] = private global <{ {{.*}} }> <{
233+
// CHECK-SAME: [[WORD]]* @keypath_once
234+
// CHECK-SAME: @"symbolic
235+
// CHECK-SAME: @"symbolic
236+
// -- instantiable in-line, size 12
237+
// CHECK-SAME: <i32 0x8000_000c>,
238+
// -- offset of T.b
239+
// CHECK-32-SAME: <i32 0x0100_000c>,
240+
// CHECK-64-SAME: <i32 0x0100_0018>,
241+
// CHECK: @"symbolic
242+
// -- tuple element #1 of T.b
243+
// CHECK-32-SAME: <i32 0x0180_0008> }>
244+
// CHECK-64-SAME: <i32 0x0180_0010> }>
245+
246+
// -- %t4: T.c.f
247+
// CHECK: [[KP_T4:@keypath(\..*)?]] = private global <{ {{.*}} }> <{
248+
// CHECK-SAME: [[WORD]]* @keypath_once
249+
// CHECK-SAME: @"symbolic
250+
// CHECK-SAME: @"symbolic
251+
// -- instantiable in-line, size 12
252+
// CHECK-SAME: <i32 0x8000_000c>,
253+
// -- offset of T.f, mutable
254+
// CHECK-32-SAME: <i32 0x0180_0018>,
255+
// CHECK-64-SAME: <i32 0x0180_0030>,
256+
// CHECK: @"symbolic
257+
// -- tuple element #0 of T.f
258+
// CHECK-SAME: <i32 0x0180_0000> }>
259+
260+
// -- %t5: T.c.g
261+
// CHECK: [[KP_T5:@keypath(\..*)?]] = private global <{ {{.*}} }> <{
262+
// CHECK-SAME: [[WORD]]* @keypath_once
263+
// CHECK-SAME: @"symbolic
264+
// CHECK-SAME: @"symbolic
265+
// -- instantiable in-line, size 12
266+
// CHECK-SAME: <i32 0x8000_000c>,
267+
// -- offset of T.f, mutable
268+
// CHECK-32-SAME: <i32 0x0180_0018>,
269+
// CHECK-64-SAME: <i32 0x0180_0030>,
270+
// CHECK: @"symbolic
271+
// -- tuple element #1 of T.f
272+
// CHECK-32-SAME: <i32 0x0180_0004> }>
273+
// CHECK-64-SAME: <i32 0x0180_0008> }>
274+
275+
// -- %t6: T.d.x
276+
// CHECK: [[KP_T6:@keypath(\..*)?]] = private global <{ {{.*}} }> <{
277+
// CHECK-SAME: [[WORD]]* @keypath_once
278+
// CHECK-SAME: @"symbolic
279+
// CHECK-SAME: @"symbolic
280+
// -- instantiable in-line, size 12
281+
// CHECK-SAME: <i32 0x8000_000c>,
282+
// -- offset of T.d
283+
// CHECK-32-SAME: <i32 0x0100_0024>,
284+
// CHECK-64-SAME: <i32 0x0100_0048>,
285+
// CHECK: @"symbolic
286+
// -- tuple element #0 of T.d
287+
// CHECK-32-SAME: <i32 0x0180_0000> }>
288+
// CHECK-64-SAME: <i32 0x0180_0000> }>
289+
290+
// -- %t7: T.d.y
291+
// CHECK: [[KP_T7:@keypath(\..*)?]] = private global <{ {{.*}} }> <{
292+
// CHECK-SAME: [[WORD]]* @keypath_once
293+
// CHECK-SAME: @"symbolic
294+
// CHECK-SAME: @"symbolic
295+
// -- instantiable in-line, size 12
296+
// CHECK-SAME: <i32 0x8000_000c>,
297+
// -- offset of T.d
298+
// CHECK-32-SAME: <i32 0x0100_0024>,
299+
// CHECK-64-SAME: <i32 0x0100_0048>,
300+
// CHECK: @"symbolic
301+
// -- tuple element #0 of T.d
302+
// CHECK-32-SAME: <i32 0x0180_0008> }>
303+
// CHECK-64-SAME: <i32 0x0180_0010> }>
304+
183305
// -- %i: Gen<A>.x
184306
// CHECK: [[KP_I:@keypath(\..*)?]] = private global <{ {{.*}} }> <{
185307
// CHECK-SAME: i32 0
@@ -236,6 +358,26 @@ entry:
236358
%m = keypath $KeyPath<S, () -> ()>, (root $S; settable_property $() -> (), id ##S.reabstracted, getter @m_get : $@convention(thin) (@in_guaranteed S) -> @out @callee_guaranteed () -> @out (), setter @m_set : $@convention(thin) (@in_guaranteed @callee_guaranteed () -> @out (), @inout S) -> ())
237359
%m2 = keypath $KeyPath<C2, () -> ()>, (root $C2; settable_property $() -> (), id ##C2.reabstracted, getter @m2_get : $@convention(thin) (@in_guaranteed C2) -> @out @callee_guaranteed () -> @out (), setter @m2_set : $@convention(thin) (@in_guaranteed @callee_guaranteed () -> @out (), @inout C2) -> ())
238360

361+
// CHECK: call %swift.refcounted* @swift_getKeyPath(i8* bitcast ({{.*}} [[KP_T0]] to i8*), i8* undef)
362+
%t0 = keypath $KeyPath<T, Int>, (root $T; stored_property #T.a : $(Int, String); tuple_element #0 : $Int)
363+
// CHECK: call %swift.refcounted* @swift_getKeyPath(i8* bitcast ({{.*}} [[KP_T1]] to i8*), i8* undef)
364+
%t1 = keypath $KeyPath<T, String>, (root $T; stored_property #T.a : $(Int, String); tuple_element #1 : $String)
365+
366+
// CHECK: call %swift.refcounted* @swift_getKeyPath(i8* bitcast ({{.*}} [[KP_T2]] to i8*), i8* undef)
367+
%t2 = keypath $KeyPath<T, String>, (root $T; stored_property #T.b : $(String, Int); tuple_element #0 : $String)
368+
// CHECK: call %swift.refcounted* @swift_getKeyPath(i8* bitcast ({{.*}} [[KP_T3]] to i8*), i8* undef)
369+
%t3 = keypath $KeyPath<T, Int>, (root $T; stored_property #T.b : $(String, Int); tuple_element #1 : $Int)
370+
371+
// CHECK: call %swift.refcounted* @swift_getKeyPath(i8* bitcast ({{.*}} [[KP_T4]] to i8*), i8* undef)
372+
%t4 = keypath $KeyPath<T, Int>, (root $T; stored_property #T.c : $(f: Int, g: String); tuple_element #0 : $Int)
373+
// CHECK: call %swift.refcounted* @swift_getKeyPath(i8* bitcast ({{.*}} [[KP_T5]] to i8*), i8* undef)
374+
%t5 = keypath $KeyPath<T, String>, (root $T; stored_property #T.c : $(f: Int, g: String); tuple_element #1 : $String)
375+
376+
// CHECK: call %swift.refcounted* @swift_getKeyPath(i8* bitcast ({{.*}} [[KP_T6]] to i8*), i8* undef)
377+
%t6 = keypath $KeyPath<T, String>, (root $T; stored_property #T.d : $(x: String, y: Int); tuple_element #0 : $String)
378+
// CHECK: call %swift.refcounted* @swift_getKeyPath(i8* bitcast ({{.*}} [[KP_T7]] to i8*), i8* undef)
379+
%t7 = keypath $KeyPath<T, Int>, (root $T; stored_property #T.d : $(x: String, y: Int); tuple_element #1 : $Int)
380+
239381
return undef : $()
240382
}
241383

branches/swift-5.1-old-llvm-branch/test/SIL/Parser/keypath.sil

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ public struct External<T> {
4343
subscript<U: Hashable>(ro _: U) -> T { get }
4444
}
4545

46+
struct T {
47+
var x: (Int, Int)
48+
var y: (a: Int, b: Int, c: Int)
49+
let z: (Int, Int)
50+
let w: (Int, C)
51+
}
52+
4653
// CHECK-LABEL: sil shared [ossa] @stored_properties
4754
sil shared [ossa] @stored_properties : $@convention(thin) () -> () {
4855
entry:
@@ -69,6 +76,21 @@ entry:
6976
return undef : $()
7077
}
7178

79+
// CHECK-LABEL: sil shared [ossa] @tuple_elements
80+
sil shared [ossa] @tuple_elements : $@convention(thin) () -> () {
81+
entry:
82+
// CHECK: keypath $WritableKeyPath<T, Int>, (root $T; stored_property #T.x : $(Int, Int); tuple_element #0 : $Int)
83+
%a = keypath $WritableKeyPath<T, Int>, (root $T; stored_property #T.x : $(Int, Int); tuple_element #0 : $Int)
84+
// CHECK: keypath $WritableKeyPath<T, Int>, (root $T; stored_property #T.y : $(a: Int, b: Int, c: Int); tuple_element #2 : $Int)
85+
%b = keypath $WritableKeyPath<T, Int>, (root $T; stored_property #T.y : $(a: Int, b: Int, c: Int); tuple_element #2 : $Int)
86+
// CHECK: keypath $KeyPath<T, Int>, (root $T; stored_property #T.z : $(Int, Int); tuple_element #1 : $Int)
87+
%c = keypath $KeyPath<T, Int>, (root $T; stored_property #T.z : $(Int, Int); tuple_element #1 : $Int)
88+
// CHECK: keypath $ReferenceWritableKeyPath<T, C>, (root $T; stored_property #T.w : $(Int, C); tuple_element #1 : $C)
89+
%d = keypath $ReferenceWritableKeyPath<T, C>, (root $T; stored_property #T.w : $(Int, C); tuple_element #1 : $C)
90+
91+
return undef : $()
92+
}
93+
7294
sil @id_a : $@convention(thin) () -> ()
7395
sil @get_s_int : $@convention(thin) (@in_guaranteed S) -> @out Int
7496
sil @set_s_int : $@convention(thin) (@in_guaranteed Int, @in_guaranteed S) -> ()

branches/swift-5.1-old-llvm-branch/test/SIL/Serialization/keypath.sil

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ entry:
8989
%a = keypath $WritableKeyPath<T, Int>, (root $T; stored_property #T.x : $(Int, Int); tuple_element #0 : $Int)
9090
// CHECK: keypath $WritableKeyPath<T, Int>, (root $T; stored_property #T.y : $(a: Int, b: Int, c: Int); tuple_element #2 : $Int)
9191
%b = keypath $WritableKeyPath<T, Int>, (root $T; stored_property #T.y : $(a: Int, b: Int, c: Int); tuple_element #2 : $Int)
92+
// CHECK: keypath $KeyPath<T, Int>, (root $T; stored_property #T.z : $(Int, Int); tuple_element #1 : $Int)
93+
%c = keypath $KeyPath<T, Int>, (root $T; stored_property #T.z : $(Int, Int); tuple_element #1 : $Int)
94+
// CHECK: keypath $ReferenceWritableKeyPath<T, C>, (root $T; stored_property #T.w : $(Int, C); tuple_element #1 : $C)
95+
%d = keypath $ReferenceWritableKeyPath<T, C>, (root $T; stored_property #T.w : $(Int, C); tuple_element #1 : $C)
9296

9397
return undef : $()
9498
}
@@ -178,8 +182,8 @@ entry:
178182
sil [serialized] [ossa] @serialize_all : $@convention(thin) () -> () {
179183
entry:
180184
%0 = function_ref @stored_properties : $@convention(thin) () -> ()
181-
%1 = function_ref @tuple_elements : $@convention(thin) () -> ()
182-
%2 = function_ref @stored_properties_generic : $@convention(thin) <D: P, E: Q, F: R> () -> ()
185+
%1 = function_ref @stored_properties_generic : $@convention(thin) <D: P, E: Q, F: R> () -> ()
186+
%2 = function_ref @tuple_elements : $@convention(thin) () -> ()
183187
%3 = function_ref @computed_properties : $@convention(thin) () -> ()
184188
%4 = function_ref @computed_properties_generic : $@convention(thin) <D: P, E: Q, F: R> () -> ()
185189
%5 = function_ref @optional : $@convention(thin) () -> ()

branches/swift-5.1-old-llvm-branch/test/SILGen/keypaths.swift

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ extension P {
4343
}
4444
}
4545

46+
struct T {
47+
var a: (Int, String)
48+
let b: (f: String, g: Int)
49+
let c: (x: C<Int>, y: C<String>)
50+
}
51+
4652
/* TODO: When we support superclass requirements on protocols, we should test
4753
* this case as well.
4854
protocol PoC : C<Int> {}
@@ -396,3 +402,23 @@ func identity<T>(_: T) {
396402
let _: WritableKeyPath<String, String> = \String.self
397403
}
398404

405+
// CHECK-LABEL: sil hidden @{{.*}}tuples
406+
func tuples(_: T) {
407+
// CHECK: keypath $WritableKeyPath<T, Int>, (root $T; stored_property #T.a : $(Int, String); tuple_element #0 : $Int)
408+
let _: WritableKeyPath<T, Int> = \T.a.0
409+
// CHECK: keypath $WritableKeyPath<T, String>, (root $T; stored_property #T.a : $(Int, String); tuple_element #1 : $String)
410+
let _: WritableKeyPath<T, String> = \T.a.1
411+
// CHECK: keypath $KeyPath<T, String>, (root $T; stored_property #T.b : $(f: String, g: Int); tuple_element #0 : $String)
412+
let _: KeyPath<T, String> = \T.b.f
413+
// CHECK: keypath $KeyPath<T, Int>, (root $T; stored_property #T.b : $(f: String, g: Int); tuple_element #1 : $Int)
414+
let _: KeyPath<T, Int> = \T.b.g
415+
// CHECK: keypath $KeyPath<T, C<Int>>, (root $T; stored_property #T.c : $(x: C<Int>, y: C<String>); tuple_element #0 : $C<Int>)
416+
let _: KeyPath<T, C<Int>> = \T.c.x
417+
// CHECK: keypath $KeyPath<T, C<String>>, (root $T; stored_property #T.c : $(x: C<Int>, y: C<String>); tuple_element #1 : $C<String>)
418+
let _: KeyPath<T, C<String>> = \T.c.y
419+
420+
// CHECK: keypath $ReferenceWritableKeyPath<T, Int>, (root $T; stored_property #T.c : $(x: C<Int>, y: C<String>); tuple_element #0 : $C<Int>; stored_property #C.x : $Int)
421+
let _: ReferenceWritableKeyPath<T, Int> = \T.c.x.x
422+
// 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)
423+
let _: KeyPath<T, String> = \T.c.x.y
424+
}

branches/swift-5.1-old-llvm-branch/test/stdlib/KeyPath.swift

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,15 @@ struct NonOffsetableProperties {
688688
var z: Int { return 0 }
689689
}
690690

691+
struct TupleProperties {
692+
// unlabeled
693+
var a: (Int, String)
694+
// labeled
695+
let b: (x: String, y: Int)
696+
// reference writable
697+
let c: (m: C<Int>, n: C<String>)
698+
}
699+
691700
func getIdentityKeyPathOfType<T>(_: T.Type) -> KeyPath<T, T> {
692701
return \.self
693702
}
@@ -710,6 +719,17 @@ keyPath.test("offsets") {
710719

711720
expectEqual(SLayout.offset(of: \.self), 0)
712721
expectEqual(SLayout.offset(of: getIdentityKeyPathOfType(S<Int>.self)), 0)
722+
723+
let TPLayout = MemoryLayout<TupleProperties>.self
724+
expectEqual(TPLayout.offset(of: \TupleProperties.a), 0)
725+
expectEqual(TPLayout.offset(of: \TupleProperties.a.0), 0)
726+
expectEqual(TPLayout.offset(of: \TupleProperties.a.1), 8)
727+
expectEqual(TPLayout.offset(of: \TupleProperties.b), 24)
728+
expectEqual(TPLayout.offset(of: \TupleProperties.b.x), 24)
729+
expectEqual(TPLayout.offset(of: \TupleProperties.b.y), 40)
730+
expectEqual(TPLayout.offset(of: \TupleProperties.c), 48)
731+
expectEqual(TPLayout.offset(of: \TupleProperties.c.m), 48)
732+
expectEqual(TPLayout.offset(of: \TupleProperties.c.n), 56)
713733
}
714734

715735
keyPath.test("identity key path") {
@@ -745,6 +765,38 @@ keyPath.test("identity key path") {
745765
expectEqual(x[keyPath: valueKey3], 679)
746766
}
747767

768+
keyPath.test("tuple key path") {
769+
let t0 = \TupleProperties.a.0
770+
expectNotNil(t0 as? KeyPath<TupleProperties, Int>)
771+
expectNotNil(t0 as? WritableKeyPath<TupleProperties, Int>)
772+
expectNil(t0 as? ReferenceWritableKeyPath<TupleProperties, Int>)
773+
774+
let t1 = \TupleProperties.a.1
775+
expectNotNil(t1 as? KeyPath<TupleProperties, String>)
776+
expectNotNil(t1 as? WritableKeyPath<TupleProperties, String>)
777+
expectNil(t1 as? ReferenceWritableKeyPath<TupleProperties, String>)
778+
779+
let t2 = \TupleProperties.b.x
780+
expectNotNil(t2 as? KeyPath<TupleProperties, String>)
781+
expectNil(t2 as? WritableKeyPath<TupleProperties, String>)
782+
expectNil(t2 as? ReferenceWritableKeyPath<TupleProperties, String>)
783+
784+
let t3 = \TupleProperties.b.y
785+
expectNotNil(t3 as? KeyPath<TupleProperties, Int>)
786+
expectNil(t3 as? WritableKeyPath<TupleProperties, Int>)
787+
expectNil(t3 as? ReferenceWritableKeyPath<TupleProperties, Int>)
788+
789+
let t4 = \TupleProperties.c.m
790+
expectNotNil(t4 as? KeyPath<TupleProperties, C<Int>>)
791+
expectNil(t4 as? WritableKeyPath<TupleProperties, C<Int>>)
792+
expectNil(t4 as? ReferenceWritableKeyPath<TupleProperties, C<Int>>)
793+
794+
let t5 = \TupleProperties.c.n.z
795+
expectNotNil(t5 as? KeyPath<TupleProperties, String>)
796+
expectNotNil(t5 as? WritableKeyPath<TupleProperties, String>)
797+
expectNotNil(t5 as? ReferenceWritableKeyPath<TupleProperties, String>)
798+
}
799+
748800
keyPath.test("let-ness") {
749801
expectNil(\C<Int>.immutable as? ReferenceWritableKeyPath)
750802
expectNotNil(\C<Int>.secretlyMutable as? ReferenceWritableKeyPath)

0 commit comments

Comments
 (0)