You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Sema] Report uses of implicitly imported decls in inlinable code
Implicitly imported decls may end up in inlinable code and break the
module API. This have been known to lead to deserialization crash and
could in theory break the generated swiftinterfaces files. Let's
explicitly check for such a case, keeping it to a warning until Swift 6
where we can make it an error.
rdar://95816286
a.implicitlyImportedMethod() // expected-warning {{instance method 'implicitlyImportedMethod()' cannot be used in an '@inlinable' function because 'libB' was implicitly imported; this is an error in Swift 6}}
40
+
41
+
// Expected implicit imports are still fine
42
+
a.localModuleMethod()
43
+
}
44
+
45
+
// BEGIN clientFileA-OldCheck.swift
46
+
import libA
47
+
@_implementationOnlyimport empty
48
+
49
+
@inlinablepublicfunc bar(){
50
+
leta=ImportedType()
51
+
a.implicitlyImportedMethod() // expected-error {{instance method 'implicitlyImportedMethod()' cannot be used in an '@inlinable' function because 'libB' was implicitly imported}}
52
+
53
+
// Expected implicit imports are still fine
54
+
a.localModuleMethod()
55
+
}
56
+
57
+
// BEGIN clientFileA-Swift6.swift
58
+
import libA
59
+
60
+
@inlinablepublicfunc bar(){
61
+
leta=ImportedType()
62
+
a.implicitlyImportedMethod() // expected-error {{instance method 'implicitlyImportedMethod()' cannot be used in an '@inlinable' function because 'libB' was implicitly imported}}
0 commit comments