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-10278] Nested type named Type is not properly resolved #52678

Closed
krzyzanowskim opened this issue Apr 3, 2019 · 0 comments
Closed

[SR-10278] Nested type named Type is not properly resolved #52678

krzyzanowskim opened this issue Apr 3, 2019 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@krzyzanowskim
Copy link
Contributor

Previous ID SR-10278
Radar None
Original Reporter @krzyzanowskim
Type Bug
Status Resolved
Resolution Duplicate
Environment

Xcode
Trunk Snapshot March 26, 2019

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, TypeChecker
Assignee None
Priority Medium

md5: b1c947205a1c8d082f79ed0e91c675d8

duplicates:

  • SR-1072 Nested type named Type should be better dealt with

Issue Description:

Given this nested type:

struct Foo: Decodable {
    struct `Type`: Decodable {
        let name: String
    }
}

"Foo.`Type`.self" is resolved to "Foo.Type", while "Foo.self.`Type`.self" is properly resolved to "Foo.`Type`.self". For example:

try JSONDecoder().decode(Foo.`Type`.self, from: "{\"name\":\"foo\"}".data(using: .utf8)!)
Untitled.swift:9:27: error: instance method 'decode(_:from:)' requires that 'Foo.Type' conform to 'Decodable'
let t = try JSONDecoder().decode(Foo.`Type`.self, from: "{\"name\":\"foo\"}".data(using: .utf8)!)
                          ^
Foundation.JSONDecoder:31:15: note: where 'T' = 'Foo.Type'
    open func decode<T>(_ type: T.Type, from data: Data) throws -> T where T : Decodable
              ^
*no* further _formatting_ is done here
@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. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

1 participant