mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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
29 lines
593 B
Swift
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)
|
|
}
|
|
}
|
|
}
|
|
}
|