Files
swift-mirror/validation-test/Sema/SwiftUI/rdar74447308.swift
Pavel Yaskevich a7524e59f4 [CSFix] Allow diagnosing missing conformance in ambiguity cases
It's possible that different overload choices could have the same
conformance requirement, so diagnostics should be able to emit an
error in situations where multiple solutions point to the missing
conformance at the same location (both in AST and requirement list).

Resolves: rdar://74447308
2021-02-18 17:21:03 -08:00

29 lines
593 B
Swift

// RUN: %target-typecheck-verify-swift -target x86_64-apple-macosx10.15 -swift-version 5
// REQUIRES: objc_interop
// REQUIRES: OS=macosx
import SwiftUI
struct Item {
let id = UUID()
let text = ""
}
class ItemList: ObservableObject {
@Published var items = [Item]()
}
struct ContentView: View {
@StateObject var list = ItemList()
var body: some View {
List {
ForEach(list.items) { item in
// expected-error@-1 {{referencing initializer 'init(_:content:)' on 'ForEach' requires that 'Item' conform to 'Identifiable'}}
Text(item.text)
}
}
}
}