[SR-7537] static/instance member's name collision breaks Encodable
#50079
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Environment
Apple Swift version 4.1 (swiftlang-902.0.48 clang-902.0.37.1)
Target: x86_64-apple-darwin17.5.0
Additional Detail from JIRA
md5: 944b9bf6640df69fe11b3dd90dce8e72
Issue Description:
```
import Foundation
struct DBUser: Encodable {
static var name: String { return "user" }
var name: String
}
let u = DBUser(name: "foo")
let data = try! JSONEncoder().encode(u)
print(String(data: data, encoding: .utf8)!)
```
Expected output is `{"name":"foo"}`, but it outputs
```
$ swift test.swift
{"name":"user"}
```
The text was updated successfully, but these errors were encountered: