Skip to content

Commit a37efe1

Browse files
committed
Tests: Use split-file to clean up client_reuse_spi.swift.
This results in clearer source locations for diagnostics.
1 parent d283ffa commit a37efe1

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

test/SPI/client_reuse_spi.swift

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
/// A module should be able to leak SPI types from an import through SPI decls
22

33
// RUN: %empty-directory(%t)
4-
// RUN: %target-swift-frontend -emit-module -DLIB_A %s -module-name A -emit-module-path %t/A.swiftmodule
5-
// RUN: %target-swift-frontend -emit-module -DLIB_B %s -module-name B -emit-module-path %t/B.swiftmodule -I %t
6-
// RUN: %target-swift-frontend -typecheck -verify -verify-ignore-unknown -DLIB_C %s -I %t
4+
// RUN: split-file %s %t
5+
// RUN: %target-swift-frontend -emit-module %t/A.swift -module-name A -emit-module-path %t/A.swiftmodule
6+
// RUN: %target-swift-frontend -emit-module %t/B.swift -module-name B -emit-module-path %t/B.swiftmodule -I %t
7+
// RUN: %target-swift-frontend -typecheck -verify -verify-ignore-unknown %t/C.swift -I %t
78

8-
#if LIB_A
9-
// expected-note@-1{{add import of module 'A'}}{{1-1=@_spi(A) import A\n}}
9+
//--- A.swift
1010
@_spi(A) public struct SecretStruct {
1111
@_spi(A) public func bar() {}
1212
}
1313

14-
#elseif LIB_B
14+
//--- B.swift
1515

1616
@_spi(A) import A
1717

1818
@_spi(B) public func foo() -> SecretStruct { fatalError() }
1919

20-
#elseif LIB_C
20+
//--- C.swift
2121

2222
@_spi(B) import B
23-
23+
// expected-note{{add import of module 'A'}}{{1-1=@_spi(A) import A\n}}
2424
var a = foo() // OK
2525
a.bar() // expected-error{{instance method 'bar()' is not available due to missing import of defining module 'A'}}
2626

2727
var b = SecretStruct() // expected-error{{cannot find 'SecretStruct' in scope}}
28-
29-
#endif

0 commit comments

Comments
 (0)