Files
swift-mirror/test/Parse/ConditionalCompilation/can_import_in_inactive.swift
Artem Chikin c73869e479 Do not fail the build on only finding incompatible-architecture modules on 'canImport'
This change refactors the module loaders to explicitly take a parameter indicating whether or not the loader is handling a 'canImport' query, in order to avoid emitting an error when finding a dependency Swift binary module with only imcompatible architecture variants present.

Resolves rdar://161175498
2025-09-23 15:26:02 -07:00

28 lines
678 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]]:{{.*}}: warning: could not find module 'SomeModule' for target '{{.*}}'; found: i386
#endif
import SomeModule