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

25 lines
847 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
extension HorizontalAlignment {
private enum MyHorizontalAlignment: AlignmentID {
static func defaultValue(in d: ViewDimensions) -> CGFloat { d.width }
}
}
extension EnvironmentValues {
var myHorizontalAlignment: AlignmentID? {
get { fatalError() }
set { self[\.MyHorizontalAlignmentEnvironmentKey.self] = newValue }
// expected-error@-1 {{subscript 'subscript(_:)' requires that 'any AlignmentID' be a class type}}
// expected-error@-2 {{cannot infer key path type from context; consider explicitly specifying a root type}}
}
}
struct MyHorizontalAlignmentEnvironmentKey: EnvironmentKey {
static var defaultValue: AlignmentID?
}