[SR-9913] Transitive dependencies and extensions of standard types #52319
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
duplicate
Resolution: Duplicates another issue
extension
Feature → declarations: `extension` declarations
multiple modules
Flag: An issue whose reproduction requires multiple modules
name lookup
Area → compiler → type checker: Name lookup
swift 5.8
unexpected behavior
Bug: Unexpected behavior or incorrect output
Attachment: Download
Environment
Swift 4.2
macOS 10.14.2
Additional Detail from JIRA
md5: de2e5f6d6e1136fb7e1c9c49826300ce
duplicates:
Issue Description:
When creating a project that has a dependency on a framework, if that framework has other dependencies, and those define "public extensions" on standard types (String, Int, Date, etc...), then those extensions become available inside the root project without explicitly importing the framework.
i.e.
Project
TestJim
imports frameworkA
. FrameworkA
imports frameworkB
.If framework
B
declares any public API (that isn't an extension) then this is not accessible fromTestJim
project withoutimport B
in the related file. This is expected behaviour.However, if framework
B
declares anextension String { public var extensionInB ... }
then theTestJim
project can access"someString".extensionInB
without having to explicitly importB
. This is not expected behaviour. We would expect this to fail to compile with the error'String' has no member 'extensionInB'
.We have attached a small sample project TestJim to highlight this problem.
The text was updated successfully, but these errors were encountered: