Why can't a subscript return an empty tuple
Seems to be possible for me. What version of Swift are you using?
struct Test {
subscript() -> () {
return ()
}
}
let a = Test()
print(a[])
Swift 4.1 on linux
Can you try a 4.2 version? Maybe this was fixed.
Thanks
Out of curiosity, what does this allow you to express? Why do you need it?
2 Likes