Files
swift-mirror/validation-test/Sema/SwiftUI/rdar57410798.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

45 lines
1.3 KiB
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
enum ColorScheme: CaseIterable, Hashable, Equatable, Identifiable {
// expected-error@-1 {{type 'ColorScheme' does not conform to protocol 'Identifiable'}}
// expected-note@-2 {{add stubs for conformance}}
case `default`
case pink
var foreground: Color {
switch self {
case .default:
return .primary
case .pink:
return .pink
}
}
}
struct IconPicker : View {
var body: some View {
Text("hello")
}
}
struct CountdownEditor : View {
@State var symbol: String = "timer"
@State var selectedColor: ColorScheme = ColorScheme.pink
var body: some View {
NavigationLink(destination: IconPicker()) {
Text("Icon")
Spacer()
Image(systemName: symbol)
.foregroundColor(selectedColor.color)
// expected-error@-1 {{cannot convert value of type 'Binding<Subject>' to expected argument type 'Color'}}
// expected-error@-2 {{referencing subscript 'subscript(dynamicMember:)' requires wrapper 'Binding<ColorScheme>'}}
// expected-error@-3 {{value of type 'ColorScheme' has no dynamic member 'color' using key path from root type 'ColorScheme'}}
}
}
}