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

Closed
hamishknight opened this issue Mar 21, 2018 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself

Comments

@hamishknight
Copy link
Contributor

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

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!
}
@hamishknight
Copy link
Contributor Author

#15412

@belkadan
Copy link
Contributor

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

@hamishknight
Copy link
Contributor Author

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

No branches or pull requests

2 participants