Files
swift-mirror/validation-test/IRGen/rdar101179225.swift
Dario Rexin 021d524056 [IRGen] Pass component generic sig when emitting key path component f… (#64871)
* [IRGen] Pass component generic sig when emitting key path component for external property

rdar://101179225

When no generic environment was present, we passed nullptr, which is not correct when the property uses an external associated type, causing crashes in IRGen. In those cases, we have to pass the component generic sig instead.

* Fix test
2023-04-07 13:58:47 -07:00

27 lines
499 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-ir > /dev/null
struct Section: Identifiable {
let id: Int
let items: [any Item]
}
protocol Item: AnyObject, Identifiable {
}
protocol P {
}
struct Iter<D, I, C>: P where D : RandomAccessCollection, I : Hashable {
init(_ xs: D, id: KeyPath<D.Element, I>, f: (D.Element) -> C) {}
}
struct V {
var s: Section
var p: some P {
Iter(s.items, id: \.id) { x in
""
}
}
}