Files
swift-mirror/test/Parse/ConditionalCompilation/macabiTargetEnv.swift
Doug Gregor e4cf74abfa Update expected diagnostics to match what SwiftIfConfig produces
For the most part, the differences between the diagnostics introduced
by the C++ implementation and the new SwiftIfConfig implementation are
cosmetic, so these are only wording changes.

The one major difference is that we've dropped the warnings about
potential typos in os/arch checks. For example, if one writes:

    #if os(bisionos)
    // ...
    #endif

The C++ implementation will produce a warning "unknown operating system
for build configuration 'os'" with a note asking "did you mean
'visionOS'"? These warnings rely on a static list of known operating
systems and architectures, which is somewhat unfortunate: the whole
point of these checks is that the Swift you're dealing with might not
have support for those operating systems/architectures, so while these
warnings can be helpful in a few cases, they also cause false
positives when porting. Therefore, I chose not to bring them forward.
2024-08-24 21:31:41 -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'}}
// expected-note@-1{{replace with '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'}}
// expected-note@-1{{replace with '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)
func underOSMacCatalyst() {
}
#endif