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-4801] Name resolution problem for packages with same-named data types #47378

Closed
swift-ci opened this issue May 4, 2017 · 0 comments
Closed

[SR-4801] Name resolution problem for packages with same-named data types #47378

swift-ci opened this issue May 4, 2017 · 0 comments

Comments

@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented May 4, 2017

Previous ID SR-4801
Radar rdar://problem/19774567
Original Reporter mb2016 (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

Environment

Problem originally spotted:
Xcode Version 8.2.1 (8C1002)

Attached test case:
Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1) on macOS 10.12.4

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

md5: a802a68cf6c5643d16a8a3ed1138dc4d

duplicates:

  • SR-898 Unresolvable "ambiguous for type lookup" error when using multiple modules

is duplicated by:

  • SR-5304 Same name for class and namespace

Issue Description:

Normally in Swift you can resolve naming collisions using the syntax ModuleName.ObjectName. For example, if you have two packages, Foo and Bar, both with a class Snafu, you can specify Foo.Snafu and Bar.Snafu.

However, if the package shares a name with one of the data types declared in the package, this breaks down. So, for example, in the attached test case, there is a package Sample with a struct named Sample. If you import that package into other code and then attempt to access the struct as follows

var s = Sample.Sample()

you get a compiler error: type 'Sample' has no member 'Sample'

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant