Created
January 17, 2019 18:03
-
-
Save matux/cf08132b597ffb80b1ec775c4f141475 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Swift compilation issue | |
// Shadowing across modules | |
// Module 1 | |
public struct S { | |
public static var a = S(a: 0) | |
public var a: Int | |
public init(a: Int) { self.a = a } | |
} | |
// Module 2 | |
extension S { | |
public static var z: S { | |
S.a.a = 0 | |
return S.a // If S.a is in another module: Instance member 'a' cannot be used on type 'S' | |
} | |
} | |
//////////////// | |
// Module 1 | |
public struct S { | |
public var a: Int | |
public init(a: Int) { self.a = a } | |
} | |
// Module 2 | |
extension S { | |
public static var a = S(a: 0) | |
public static var z: S { | |
S.a.a = 0 // Static member 'a' cannot be used on instance of type 'S' | |
return S.a | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment