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-7251] Redeclaring a variable with a type in a generic extension doesn't error #49799

hamishknight opened this issue Mar 21, 2018 · 3 comments


Copy link

hamishknight commented Mar 21, 2018

Previous ID SR-7251
Radar None
Original Reporter @hamishknight
Type Bug
Status Closed
Resolution Done

Swift version 4.2-dev (LLVM cef3fe6d75, Clang bdc970d89c, Swift 5b60ace)
Target: x86_64-apple-darwin17.4.0

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

md5: 455775109cfbec5e12494dbe7e1b6c61

Issue Description:

This correctly doesn't compile:

struct S {}
extension S {
  static var i: Int { return 0 }
  struct i {} // error: Invalid redeclaration of 'i'

But this does compile:

struct S1<T> {}
extension S1 {
  static var i: Int { return 0 }
  struct i {} // This is fine!
Copy link
Collaborator Author

hamishknight commented Mar 22, 2018


Copy link

belkadan commented Mar 22, 2018

Any fixes here are going to have to be limited to Swift 5 mode, since someone might be relying on them in Swift 4.

Copy link
Collaborator Author

hamishknight commented Mar 28, 2018

Fixed in the above linked pull request; the redeclaration will be warning in Swift 4 mode and an error in Swift 5 mode.

@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
None yet

No branches or pull requests

2 participants