SCNetworkReachabilityFlags beta 4 issue

Swifters:
  I’m attempting to port a library to Xcode 8 beta 4 and have run into a peculiar issue with SCNetworkReachabilityFlags. Prior to beta 4, this extension on SCNetworkReachabilityFlags which provided convenience Bool properties worked just fine:

extension SCNetworkReachabilityFlags {
    var isLocalAddress: Bool {
        return contains(.isLocalAddress)
    }

    var isDirect: Bool {
        return contains(.isDirect)
    }
}

Now, it throws an error:

instance member 'isLocalAddress' cannot be used on type ‘SCNetworkReachabilityFlags’

Now, this is rather peculiar, since other OptionSets I create with options and properties of the same name work fine. There must be something peculiar about SCNetworkReachabilityFlags. If I change the properties to no longer match the option values, it builds fine. Is this a bug? If it is, I’m assuming it’s better to report it to Apple rather than swift.org <http://swift.org/&gt;, or should I do both?

Jon Shier

In master I’m seeing it at least be consistent, warning about both members and not just ‘isLocalAddress’. Since it seems to be a compiler issue I think just filing it at bugs.swift.org is fine, though I’ll warn you that since there’s an easy workaround it might not get prioritized.

Jordan

···

On Aug 5, 2016, at 15:09, Jon Shier via swift-users <swift-users@swift.org> wrote:

Swifters:
  I’m attempting to port a library to Xcode 8 beta 4 and have run into a peculiar issue with SCNetworkReachabilityFlags. Prior to beta 4, this extension on SCNetworkReachabilityFlags which provided convenience Bool properties worked just fine:

extension SCNetworkReachabilityFlags {
    var isLocalAddress: Bool {
        return contains(.isLocalAddress)
    }

    var isDirect: Bool {
        return contains(.isDirect)
    }
}

Now, it throws an error:

instance member 'isLocalAddress' cannot be used on type ‘SCNetworkReachabilityFlags’

Now, this is rather peculiar, since other OptionSets I create with options and properties of the same name work fine. There must be something peculiar about SCNetworkReachabilityFlags. If I change the properties to no longer match the option values, it builds fine. Is this a bug? If it is, I’m assuming it’s better to report it to Apple rather than swift.org <http://swift.org/&gt;, or should I do both?

Jon Shier
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users