Closed
Description
Previous ID | SR-10088 |
Radar | None |
Original Reporter | @hamishknight |
Type | Bug |
Status | Resolved |
Resolution | Done |
Environment
Swift version 5.0-dev (LLVM 94d957ca75, Swift f07a84a)
Target: x86_64-apple-darwin18.2.0
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, StarterBug, TypeChecker |
Assignee | jumhyn (JIRA) |
Priority | Medium |
md5: d6e10743f8e36163cbd39a4e83fc2569
Issue Description:
For functions, we don't allow overloads to differ by escaping-ness:
struct S {
func foo(_ fn: () -> Void) {}
func foo(_ fn: @escaping () -> Void) {} // error: Invalid redeclaration of 'foo'
}
However we do allow this for subscripts:
struct S {
subscript(_ fn: () -> Void) -> Int { return 0 }
subscript(_ fn: @escaping () -> Void) -> Int { return 0 } // Okay
}
We should reject such subscript overloads like we do with functions.