File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -5842,6 +5842,11 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
5842
5842
// For the current module, consider both private and public imports.
5843
5843
ModuleDecl::ImportFilter Filter = ModuleDecl::ImportFilterKind::Exported;
5844
5844
Filter |= ModuleDecl::ImportFilterKind::Default;
5845
+
5846
+ // For private swiftinterfaces, also look through @_spiOnly imports.
5847
+ if (Options.PrintSPIs )
5848
+ Filter |= ModuleDecl::ImportFilterKind::SPIOnly;
5849
+
5845
5850
SmallVector<ImportedModule, 4 > Imports;
5846
5851
Options.CurrentModule ->getImportedModules (Imports, Filter);
5847
5852
Original file line number Diff line number Diff line change
1
+ /// Check that we correctly refer to @_spiOnly imported modules in the private
2
+ /// swiftinterface and not to one of the redeclarations.
3
+ // REQUIRES: objc_interop
4
+
5
+ // RUN: %empty-directory(%t)
6
+ // RUN: split-file %s %t
7
+
8
+ // RUN: %target-swift-frontend -emit-module %t/Client.swift -I %t \
9
+ // RUN: -enable-library-evolution -swift-version 5 \
10
+ // RUN: -experimental-spi-only-imports \
11
+ // RUN: -emit-module-interface-path %t/Client.swiftinterface \
12
+ // RUN: -emit-private-module-interface-path %t/Client.private.swiftinterface
13
+
14
+ // RUN: %target-swift-typecheck-module-from-interface(%t/Client.swiftinterface) -I %t
15
+
16
+ /// We print a reference to A in the private swiftinterface.
17
+ // RUN: %FileCheck %s < %t/Client.private.swiftinterface
18
+ // RUN: %target-swift-typecheck-module-from-interface(%t/Client.private.swiftinterface) -I %t \
19
+ // RUN: -module-name Client
20
+
21
+ //--- module.modulemap
22
+ module A {
23
+ header " A.h "
24
+ }
25
+
26
+ module B {
27
+ header " B.h "
28
+ }
29
+
30
+ //--- A.h
31
+ @interface MovingType
32
+ @end
33
+
34
+ //--- B.h
35
+ @class MovingType;
36
+
37
+ //--- Client.swift
38
+ import B
39
+ @_spiOnly import A
40
+
41
+ @_spi ( _)
42
+ public func foo( _ a: MovingType ) { }
43
+ // CHECK: A.MovingType
You can’t perform that action at this time.
0 commit comments