title: Why does encode favor static properties over instance properties?
body: <p>Given a struct with a static and instance property that share a name:</p>
  
  <pre class="lang-swift prettyprint-override"><code>struct MyStruct {
      // The version on the type
      static let version = 1
  
      // The version on the instance based on the static version
      var version: Int = MyStruct.version
  }
  </code></pre>
  
  <p>If I add custom <code>Codable</code> conformance, the container will favor the static over the instance var. Ex:</p>
  
  <pre class="lang-swift prettyprint-override"><code>extension MyStruct: Codable {
      func encode(to encoder: Encoder) throws {
          var container = encoder.container(keyedBy: CodingKeys.self)
  
          try container.encode(version, forKey: .version) 
      }
  
      enum CodingKeys: String, CodingKey {
          case version
      }
  }
  </code></pre>
  
  <p>Then go to encode an instance:</p>
  
  <pre class="lang-swift prettyprint-override"><code>let myStruct = MyStruct(version: 2)
  let encoded = try! JSONEncoder().encode(myStruct)
  try! JSONDecoder().decode(MyStruct.self, from: encoded) // MyStruct version 1
  </code></pre>
  
  <p>I can solve this issue by qualifying with self, <code>container.encode(self.version, forKey: .version)</code>. But that's not the point.</p>
  
  <p>This is weird. Why is this happening? </p>