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-1389] Types in modules cannot be uniquely referenced if a type and module have the same name. #43998

Closed
dennisweissmann opened this issue May 3, 2016 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@dennisweissmann
Copy link

dennisweissmann commented May 3, 2016

Previous ID SR-1389
Radar None
Original Reporter @dennisweissmann
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

Environment

OS X 10.11.4 (15E65), Xcode 7.3, snapshot: swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a.xctoolchain

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

md5: 0b5c364f6ff522a65100a139bf740e02

duplicates:

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

Issue Description:

Scenario:

import MyFramework // <- has a public struct "A"

struct A {} // internal to my project

let a = MyFramework.A()  // <- Type MyFramework has no member "A"

It seems one can't reference the imported struct of the module MyFramework. If one uses `let a = A()` the internal struct is used (which, of course, makes sense).

A related issue came up recently on Stackoverflow: http://stackoverflow.com/questions/36991735/how-to-reference-a-type-in-a-module-that-has-a-type-with-the-same-name-as-the-mo

The problem here is only a little bit different (the class/struct with the same name as the framework is in another framework, not in the local project as above):

// in framework Something
public struct A {}
public class Something {}

// in framework OtherThing
public struct A {}

// in the project
import Something
import OtherThing

let a = Something.A()  // <- "A" is not a member of type "Something"

I have attached a workspace with 2 framework projects and an iOS project that demonstrates the issue.

@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
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

1 participant