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-4654] Struct extension implicitly imported from framework #47231

Closed
swift-ci opened this issue Apr 21, 2017 · 0 comments
Closed

[SR-4654] Struct extension implicitly imported from framework #47231

swift-ci opened this issue Apr 21, 2017 · 0 comments
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 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.8 unexpected behavior Bug: Unexpected behavior or incorrect output

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Apr 21, 2017

Previous ID SR-4654
Radar None
Original Reporter rermolov (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

Apple Swift version 3.1 (swiftlang-802.0.51 clang-802.0.41)

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

md5: 5abb5d6469bc94cf525cf75ec7dd1249

duplicates:

Issue Description:

Struct extension from framework is accessible in file even if framework is not imported.

Example

Module A:

extension Date {
  public var someField: Int64 {
    return 123
  }
}

File1 from app:

import A
// do other stuff

File2 from app:

// no import A
Date().someField // compiles without errors

Expected behavior

Struct extensions should not be available without explicit framework import, like classes.

In general cases it is not a big deal, but it becomes a problem when you have module B with same extension, because in that case compilation fails with

ambiguous use of 'someField'

and you can't solve this issue by importing only one framework.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added duplicate Resolution: Duplicates another issue compiler The Swift compiler in itself multiple files Flag: An issue whose reproduction requires multiple files swift 5.8 name lookup Area → compiler → type checker: Name lookup multiple modules Flag: An issue whose reproduction requires multiple modules extension Feature → declarations: `extension` declarations unexpected behavior Bug: Unexpected behavior or incorrect output labels May 11, 2023
This issue was closed.
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 duplicate Resolution: Duplicates another issue 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.8 unexpected behavior Bug: Unexpected behavior or incorrect output
Projects
None yet
Development

No branches or pull requests

2 participants