[swift-users] Method of same name is shadowing a property in Swift 3

Zhao Xin owenzx at gmail.com
Tue Sep 13 18:47:49 CDT 2016


You said your issue only existed in Swift 3. However, you issue still
exists in Xcode 7.3.1, which uses Swift 2.2. I tested your playground code.

protocol QueryRow {
    var key: Any { get }
    func key(at index: UInt) -> Any?
}

var row: QueryRow

row.key as? String

Zhaoxin

On Wed, Sep 14, 2016 at 7:08 AM, Jens Alfke via swift-users <
swift-users at swift.org> wrote:

>
> On Sep 13, 2016, at 3:13 PM, Hooman Mehr <hooman at mac.com> wrote:
>
> I guess the reason this is happening is some attempt at backward
> compatibility, but this is clearly causing a serious bug. Have you reported
> it?
>
>
> No; I’m not a Swift expert, and am not following the 3.0 transition
> closely enough to tell whether this is a bug or just some unfortunate but
> intentional fallout from the transition.
>
> —Jens
>
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160914/025de04b/attachment.html>


More information about the swift-users mailing list