> Am 15.04.2017 um 17:33 schrieb Xiaodi Wu <xiaodi...@gmail.com>: > > I think you misunderstand how access modifiers currently work with > extensions. It is not permitted to use an access modifier inside an extension > that is higher than that of the extension itself.
class Check {} fileprivate extension Check { public func px() { print("It compiles!") } } Check().px() This code executes without complains — but your example is right, it fails if the extension is marked private… wtf? Access modifiers aren't even mentioned in https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Extensions.html#//apple_ref/doc/uid/TP40014097-CH24-ID151 It really seems to me that the current extension-model is somewhat broken; do you have a link to documentation of access levels for extensions? > ``` > private struct S { > private extension { > func f() { } // what is the access level of `f`? > } > } > ``` > > If `f` is private, then it is invisible outside the extension. But `f` cannot > be `fileprivate`, because `fileprivate` is more visible than the private > extension and is therefore not allowed. I'd simply say f is private and only visible inside the extension…
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution