swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
66.77k stars 10.29k forks source link

[SR-15564] Failed to produce diagnostic for expression #57867

Open swift-ci opened 2 years ago

swift-ci commented 2 years ago
Previous ID SR-15564
Radar None
Original Reporter stemichels (JIRA User)
Type Bug

Attachment: Download

Environment Xcode Version 13.1 (13A1030d)
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: b2b79469062bc0afa91f4a70485dd729

Issue Description:

The compiler failed to produce diagnostic for method TestCrashView_Previews.previews. In this case the parameter should be "add: Entry.init" instead of "add: Value.init"

struct Value: Identifiable, Codable {
    var id: Int = 0
}
struct TestCrashView<V>: View where V : RandomAccessCollection, V.Element: Identifiable {
    @Binding var value: V
    let add: () -> V.Element

    var body: some View {
        Text("...")
    }
}
struct TestCrashView_Previews: PreviewProvider {
    struct Entry: Identifiable {
        var id: Int = 1
    }
    static var previews: some View {
        let values: [Entry] = []
        TestCrashView(value: .constant(values), add: Value.init)
    }
}
swift-ci commented 2 years ago

Comment by Stephan Michels (JIRA)

Same problem with Xcode Version 13.2 beta 2 (13C5081f)