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-12890] Unable to explicitly qualify a shadowed type alias #55311

Open
swift-ci opened this issue May 23, 2020 · 0 comments
Open

[SR-12890] Unable to explicitly qualify a shadowed type alias #55311

swift-ci opened this issue May 23, 2020 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-12890
Radar None
Original Reporter andrewchang-bird (JIRA User)
Type Bug
Environment
Apple Swift version 5.2.2 (swiftlang-1103.0.32.6 clang-1103.0.32.51)
Target: x86_64-apple-darwin19.4.0
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 91dc18a2dde2fd5052dc515d364a25f8

Issue Description:

Shadowing a type alias declared by an inherited protocol breaks explicit type qualification.

protocol One {
  typealias Nominal = String
  typealias Generic<T> = Array<T>
}


class Two: One {
  typealias Nominal = Int
  typealias Generic<T> = Dictionary<String, T>
  
  func method(nominal: Nominal) {}
  func method(oneNominal: One.Nominal) {}
  func method(twoNominal: Two.Nominal) {} // Ambiguous type name 'Nominal' in 'Two'
  
  func method(generic: Generic<Bool>) {}
  func method(oneGeneric: One.Generic<Bool>) {} // Type alias 'Generic' can only be used with a concrete type or generic parameter base
  func method(twoGeneric: Two.Generic<Bool>) {} // Ambiguous type name 'Generic' in 'Two'
}

It feels like references to `Nominal` vs `Two.Nominal` should be treated the same within `Two`.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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.
Projects
None yet
Development

No branches or pull requests

1 participant