Files
swift-mirror/test/SPI/implementation_only_spi_import.swift
Henrik G. Olsson cbc0ec3b88 Add -verify-ignore-unrelated where necessary (NFC)
These are tests that fail in the next commit without this flag. This
does not add -verify-ignore-unrelated to all tests with -verify, only
the ones that would fail without it. This is NFC since this flag is
currently a no-op.
2025-10-04 14:19:52 -07:00

24 lines
635 B
Swift

/// @_implementationOnly imports should be compatible with @_spi imports
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module -DLIB_A %s -module-name A -emit-module-path %t/A.swiftmodule
// RUN: %target-swift-frontend -emit-module -DLIB_B %s -module-name B -emit-module-path %t/B.swiftmodule -I %t
// RUN: rm %t/A.swiftmodule
// RUN: %target-swift-frontend -typecheck -verify -verify-ignore-unrelated -DLIB_C %s -I %t
#if LIB_A
@_spi(A) public func foo() {}
#elseif LIB_B
@_spi(A) @_implementationOnly import A
foo() // OK
#elseif LIB_C
import B
foo() // expected-error{{cannot find 'foo' in scope}}
#endif