File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -938,6 +938,21 @@ void CrossModuleOptimization::makeDeclUsableFromInline(ValueDecl *decl) {
938
938
if (decl->getEffectiveAccess () >= AccessLevel::Package)
939
939
return ;
940
940
941
+ // FIXME: rdar://130456707
942
+ // Currently not all types are visited in canSerialize* calls, sometimes
943
+ // resulting in an internal type getting @usableFromInline, which is
944
+ // incorrect.
945
+ // For example, for `let q = P() as? Q`, where Q is an internal class
946
+ // inherting a public class P, Q is not visited in the canSerialize*
947
+ // checks, thus resulting in `@usableFromInline class Q`; this is not
948
+ // the intended behavior in the conservative mode as it modifies AST.
949
+ //
950
+ // To properly fix, instruction visitor needs to be refactored to do
951
+ // both the "canSerialize" check (that visits all types) and serialize
952
+ // or update visibility (modify AST in non-conservative modes).
953
+ if (isPackageCMOEnabled (M.getSwiftModule ()))
954
+ return ;
955
+
941
956
// We must not modify decls which are defined in other modules.
942
957
if (M.getSwiftModule () != decl->getDeclContext ()->getParentModule ())
943
958
return ;
You can’t perform that action at this time.
0 commit comments