Skip to content

Commit 879f37c

Browse files
committed
Sema: Test that SPI operators are only printed in the public swiftinterface
This was already working as expected. Adding a test to ensure it doesn't regress.
1 parent 937e6c5 commit 879f37c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/SPI/private_swiftinterface.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@
2929

3030
/// Test the textual interfaces generated from this test.
3131
// RUN: %target-swift-frontend -typecheck %s -emit-module-interface-path %t/Main.swiftinterface -emit-private-module-interface-path %t/Main.private.swiftinterface -enable-library-evolution -swift-version 5 -I %t -module-name Main
32-
// RUN: %FileCheck -check-prefix=CHECK-PUBLIC %s < %t/Main.swiftinterface
33-
// RUN: %FileCheck -check-prefix=CHECK-PRIVATE %s < %t/Main.private.swiftinterface
32+
// RUN: cat %t/Main.swiftinterface | %FileCheck -check-prefix=CHECK-PUBLIC %s
33+
// RUN: cat %t/Main.private.swiftinterface | %FileCheck -check-prefix=CHECK-PRIVATE %s
3434
// RUN: %target-swift-frontend -typecheck-module-from-interface -I %t %t/Main.swiftinterface
3535
// RUN: %target-swift-frontend -typecheck-module-from-interface -I %t %t/Main.private.swiftinterface -module-name Main
3636

3737
/// Both the public and private textual interfaces should have
3838
/// SPI information with `-library-level spi`.
3939
// RUN: %target-swift-frontend -typecheck %s -emit-module-interface-path %t/SPIModule.swiftinterface -emit-private-module-interface-path %t/SPIModule.private.swiftinterface -enable-library-evolution -swift-version 5 -I %t -module-name SPIModule -library-level spi
40-
// RUN: %FileCheck -check-prefix=CHECK-PRIVATE %s < %t/SPIModule.swiftinterface
41-
// RUN: %FileCheck -check-prefix=CHECK-PRIVATE %s < %t/SPIModule.private.swiftinterface
40+
// RUN: cat %t/SPIModule.swiftinterface | %FileCheck -check-prefix=CHECK-PRIVATE %s
41+
// RUN: cat %t/SPIModule.private.swiftinterface | %FileCheck -check-prefix=CHECK-PRIVATE %s
4242
// RUN: %target-swift-frontend -typecheck-module-from-interface -I %t %t/SPIModule.swiftinterface
4343
// RUN: %target-swift-frontend -typecheck-module-from-interface -I %t %t/SPIModule.private.swiftinterface -module-name SPIModule
4444

@@ -238,6 +238,11 @@ extension IOIPublicStruct : LocalPublicProto {}
238238
// CHECK-PRIVATE: @_spi(S) private var spiTypeInFrozen1
239239
}
240240

241+
public struct OpType {}
242+
@_spi(S) public func +(_ s1: OpType, _ s2: OpType) -> OpType { s1 }
243+
// CHECK-PRIVATE: @_spi(S) public func + (s1: {{.*}}.OpType, s2: {{.*}}.OpType) -> {{.*}}.OpType
244+
// CHECK-PUBLIC-NOT: func +
245+
241246
// The dummy conformance should be only in the private swiftinterface for
242247
// SPI extensions.
243248
@_spi(LocalSPI)

0 commit comments

Comments
 (0)