Files
swift-mirror/test/Parse/ConditionalCompilation/canimport_in_inactive.swift
Rintaro Ishizaki 7b37072adf [Parse] Don't evaluate IfConfig condtion inside inactive block
rdar://problem/50903021
2019-06-19 09:39:54 -07:00

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