Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-3908] Extension methods visible without importing module in a file #46493

Open
ankitspd opened this issue Feb 9, 2017 · 5 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself declarations Feature: declarations extension Feature → declarations: `extension` declarations multiple files Flag: An issue whose reproduction requires multiple files multiple modules Flag: An issue whose reproduction requires multiple modules name lookup Area → compiler → type checker: Name lookup swift 5.9 unexpected behavior Bug: Unexpected behavior or incorrect output

Comments

@ankitspd
Copy link
Member

ankitspd commented Feb 9, 2017

Previous ID SR-3908
Radar rdar://problem/16154294
Original Reporter @aciidb0mb3r
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 9
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 7cc3dd991a1637efb2f2ca9e6d75b83d

is duplicated by:

Issue Description:

The attached package contains three targets:

  1. foo - defines a Version struct which can be initialized by a string param.
  2. bar - depends on foo and defines an extension with an initializer to Version with no parameters
  3. exe - depends on foo and bar and has two files.
  • other.swift - imports bar
  • main.swift - imports foo and calls Version()

This should not compile or run because Version() is defined in bar and bar is not imported in main.swift.
It works as expected after removing import bar from other.swift (needs a swift package clean though).

@belkadan
Copy link
Contributor

Old, old bug. :-)

@swift-ci
Copy link
Collaborator

Comment by Fabio Mignogna (JIRA)

Any news on this bug?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@notapplicableio
Copy link

Looks like this is still a thing in Xcode 14.3/Swift 5.8

@AnthonyLatsis AnthonyLatsis added multiple files Flag: An issue whose reproduction requires multiple files extension Feature → declarations: `extension` declarations name lookup Area → compiler → type checker: Name lookup multiple modules Flag: An issue whose reproduction requires multiple modules swift 5.8 unexpected behavior Bug: Unexpected behavior or incorrect output labels May 11, 2023
@piotrsmajek
Copy link

XCode 15.0/Swift 5.9 same problem

@KeithBauerANZ
Copy link

Made a longwinded thread that eventually tracked back here: https://forums.swift.org/t/find-how-a-symbol-was-imported/68052

@AnthonyLatsis AnthonyLatsis added declarations Feature: declarations swift 5.9 and removed swift 5.8 labels Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself declarations Feature: declarations extension Feature → declarations: `extension` declarations multiple files Flag: An issue whose reproduction requires multiple files multiple modules Flag: An issue whose reproduction requires multiple modules name lookup Area → compiler → type checker: Name lookup swift 5.9 unexpected behavior Bug: Unexpected behavior or incorrect output
Projects
None yet
Development

No branches or pull requests

7 participants