Skip to content

[SR-7251] Redeclaring a variable with a type in a generic extension doesn't error #49799

@hamishknight

Description

@hamishknight
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!
}

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions