Files
swift-mirror/validation-test/Sema/SwiftUI/rdar74447308.swift
Henrik G. Olsson cbc0ec3b88 Add -verify-ignore-unrelated where necessary (NFC)
These are tests that fail in the next commit without this flag. This
does not add -verify-ignore-unrelated to all tests with -verify, only
the ones that would fail without it. This is NFC since this flag is
currently a no-op.
2025-10-04 14:19:52 -07:00

30 lines
654 B
Swift

// RUN: %target-typecheck-verify-swift -verify-ignore-unrelated -target %target-cpu-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]()
}
@available(SwiftStdlib 5.3, *)
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)
}
}
}
}