Files
swift-mirror/test/Parse/ConditionalCompilation/macabiTargetEnv.swift
Allan Shortlidge ecc1a2de2c Tests: Drop maccatalyst_support requirement for several tests.
As much as possible, we should avoid using `REQUIRES: maccatalyst_support`
since tests restricted this way are not run in PR tests. Many tests that
exercise macCatalyst behaviors can be run in a macOS configuration, without
full macCatalyst standard library support.

Also, adopt `%target-cpu` lit substitution where appropriate to avoid needless
standard library module rebuilds when running tests locally.
2024-07-19 17:02:28 -07:00

37 lines
1.3 KiB
Swift

// RUN: %swift -swift-version 4 -typecheck %s -verify -target %target-cpu-apple-ios12.0-macabi -parse-stdlib
// RUN: %swift-ide-test -swift-version 4 -test-input-complete -source-filename=%s -target %target-cpu-apple-ios12.0-macabi
// REQUIRES: OS=macosx || OS=maccatalyst
#if targetEnvironment(macabi) // expected-warning {{'macabi' has been renamed to 'macCatalyst'}} {{23-29=macCatalyst}}
func underMacABI() {
foo() // expected-error {{cannot find 'foo' in scope}}
}
#endif
#if !targetEnvironment(macabi) // expected-warning {{'macabi' has been renamed to 'macCatalyst'}} {{24-30=macCatalyst}}
// This block does not typecheck but the #if prevents it from
// from being a compiler error.
let i: SomeType = "SomeString" // no-error
#endif
#if targetEnvironment(macCatalyst)
func underTargetEnvironmentMacCatalyst() {
foo() // expected-error {{cannot find 'foo' in scope}}
}
#endif
// Make sure we don't treat the macabi environment as a simulator.
#if targetEnvironment(simulator)
// This block does not typecheck but the #if prevents it from
// from being a compiler error.
let i: SomeType = "SomeString" // no-error
#endif
#if os(macCatalyst)
// expected-warning@-1 {{unknown operating system for build configuration 'os'}}
// expected-note@-2 *{{did you mean}}
func underOSMacCatalyst() {
}
#endif