Skip to content

Commit 8b099cd

Browse files
author
Harlan Haskins
committed
[ParseableInterface] Add test for #if canImport
This works correclty as-is, but it should be tested. rdar://48733713
1 parent 384882d commit 8b099cd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: echo 'public func externalFunc() {}' | %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/Library.swiftinterface -
3+
// RUN: %target-swift-frontend -typecheck %s -I %t
4+
5+
#if canImport(Library)
6+
import Library
7+
externalFunc()
8+
#else
9+
#error("unable to import Library from its parseable interface")
10+
#endif
11+
12+
#if canImport(LibraryThatDoesNotExist)
13+
#error("should not return true for library that does not exist")
14+
#endif

0 commit comments

Comments
 (0)