Created
January 9, 2022 08:24
-
-
Save ApolloZhu/40b102fca90e35c83ad0a6a35eab8697 to your computer and use it in GitHub Desktop.
Testing 'canImport()' non-existing submodule in system frameworks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RUN: %target-typecheck-verify-swift | |
// Testing 'canImport()' non-existing submodule in system frameworks. | |
#if canImport(CoreImage) | |
import CoreImage | |
#if !canImport(CoreImage.CIFilterBuiltins) | |
#error("Should can import CoreImage.CIFilterBuiltins") | |
#endif | |
// Should fail if checked for a non-existing submodule. | |
#if canImport(CoreImage.BOGUS) | |
import CoreImage.CIFilterBuiltins | |
#endif | |
func testNotImported() { | |
if #available(iOS 13.0, tvOS 13.0, macOS 10.15, *) { | |
_ = CIFilter.qrCodeGenerator() | |
// expected-error@-1 {{type 'CIFilter' has no member 'qrCodeGenerator'}} | |
} | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment