Files
swift-mirror/test/Parse/ConditionalCompilation/can_import_in_inactive.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

28 lines
676 B
Swift

// RUN: %empty-directory(%t)
// RUN: mkdir -p %t/Modules/SomeModule.swiftmodule
// RUN: echo 'DUMMY' > %t/Modules/SomeModule.swiftmodule/i386.swiftmodule
// RUN: not %target-swift-frontend -typecheck -I %t/Modules %s 2>&1 | %FileCheck %s
// REQUIRES: CPU=x86_64
// Testing 'canImport()' not emitting error in inactive #if .. #endif blocks.
#if false
#if canImport(SomeModule) // Ok
// CHECK-NOT: :[[@LINE-1]]:
#endif
#endif
#if true
#else
#if canImport(SomeModule) // Ok
// CHECK-NOT: :[[@LINE-1]]:
#endif
#endif
#if canImport(SomeModule)
// CHECK: :[[@LINE-1]]:{{.*}}: error: could not find module 'SomeModule' for target '{{.*}}'; found: i386
#endif
import SomeModule