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
See the attached sample project and run `swift build` it should fail but it doesn't, see below for details.
Currently there is a case with transitive modules where you do not have to import a module to get extensions from it if you import the module containing the type its extending, and a module that depends on the module adding the extension. This is fixed if you add `@_implementationOnly` to the import of the module that adds the extension, but ideally it would be required to import any module you use an extension from (unless it's explicitly `@_exported`
In the sample project you can see that `import transitive` pollutes the `funcFromExtension` into the main `import-pollution` target. By changing the import to `@_implementationOnly import extender` you fix this issue.
I know this has been an issue for a long time since this also applies to extensions on types defined in system modules, and because of that it may never be "fixed" since it would be a source incompatible change, but I wanted to have an issue about this since I couldn't find any others.
In projects with many modules this makes it hard to keep your dependency graph actually explicit and introduces surprises when you remove a dependency on a module and end up losing transitive dependencies you were implicitly depending on.
The text was updated successfully, but these errors were encountered:
Attachment: Download
Additional Detail from JIRA
md5: 1d53b710921ee26cf7a64bfe9dee53f4
Issue Description:
See the attached sample project and run `swift build` it should fail but it doesn't, see below for details.
Currently there is a case with transitive modules where you do not have to import a module to get extensions from it if you import the module containing the type its extending, and a module that depends on the module adding the extension. This is fixed if you add `@_implementationOnly` to the import of the module that adds the extension, but ideally it would be required to import any module you use an extension from (unless it's explicitly `@_exported`
In the sample project you can see that `import transitive` pollutes the `funcFromExtension` into the main `import-pollution` target. By changing the import to `@_implementationOnly import extender` you fix this issue.
I know this has been an issue for a long time since this also applies to extensions on types defined in system modules, and because of that it may never be "fixed" since it would be a source incompatible change, but I wanted to have an issue about this since I couldn't find any others.
In projects with many modules this makes it hard to keep your dependency graph actually explicit and introduces surprises when you remove a dependency on a module and end up losing transitive dependencies you were implicitly depending on.
The text was updated successfully, but these errors were encountered: