Skip to content

Commit 155c6a9

Browse files
author
Harlan Haskins
authored
Merge pull request #23450 from harlanhaskins/can-can-you-do-the-import
[ParseableInterface] Add test for #if canImport
2 parents c280dab + 8b099cd commit 155c6a9

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)