Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-7537] static/instance member's name collision breaks Encodable #50079

Closed
t-ae opened this issue Apr 26, 2018 · 1 comment
Closed

[SR-7537] static/instance member's name collision breaks Encodable #50079

t-ae opened this issue Apr 26, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@t-ae
Copy link
Contributor

t-ae commented Apr 26, 2018

Previous ID SR-7537
Radar None
Original Reporter @t-ae
Type Bug
Status Resolved
Resolution Done
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
Votes 0
Component/s Standard Library
Labels Bug
Assignee None
Priority Medium

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"}
```

@eeckstein
Copy link
Member

This should be fixed by #16139

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants