File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -2925,6 +2925,10 @@ internal func calculateAppendedKeyPathSize(
29252925
29262926 if isLast {
29272927 break
2928+ } else {
2929+ // Add the intermediate type.
2930+ result = MemoryLayout< Int> . _roundingUpToAlignment( result)
2931+ result &+= MemoryLayout< Int> . size
29282932 }
29292933 }
29302934
Original file line number Diff line number Diff line change @@ -1271,5 +1271,26 @@ if #available(SwiftStdlib 6.3, *) {
12711271 }
12721272}
12731273
1274- runAllTests ( )
1274+ struct Thingy {
1275+ var thingy : Thingy { self }
1276+
1277+ var a = 42
1278+ }
1279+
1280+ extension Int {
1281+ var subscripty : Thingy {
1282+ Thingy ( a: 67 )
1283+ }
1284+ }
1285+
1286+ keyPath. test ( " appending keypath with multiple components " ) {
1287+ var kp : KeyPath = \Thingy . self
1288+ kp = kp. appending ( path: \. thingy)
1289+ kp = kp. appending ( path: \. a. subscripty)
12751290
1291+ let t = Thingy ( )
1292+ let value = t [ keyPath: kp]
1293+ expectEqual ( value. a, 67 )
1294+ }
1295+
1296+ runAllTests ( )
You can’t perform that action at this time.
0 commit comments