mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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.
45 lines
1.3 KiB
Swift
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'}}
|
|
}
|
|
}
|
|
}
|