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-10939] SwiftUI StaticMember static var type inference #53330

Open
Agarunov opened this issue Jun 16, 2019 · 1 comment
Open

[SR-10939] SwiftUI StaticMember static var type inference #53330

Agarunov opened this issue Jun 16, 2019 · 1 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

Comments

@Agarunov
Copy link

Previous ID SR-10939
Radar None
Original Reporter @Agarunov
Type Bug
Environment

Xcode 11 beta 1, Swift 5.1

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

md5: 09e5a79870bc2e74cdf849d58940a97f

Issue Description:

Compiler errors in this code:

protocol SomeProtocol {
    typealias Member = StaticMember<Self>
}

struct A: SomeProtocol {
    let name: String
}

extension StaticMember where Base: SomeProtocol {
    static var foo: A.Member { .init(A(name: "foo")) } // ok
    static var baz: A.Member { .init(.init(name: "baz")) } // ok
    static var bar: A.Member { StaticMember<A>(A(name: "bar")) } // ok
    static var bat: A.Member { StaticMember(A(name: "bat"))} // error: 'A' is not convertible to 'Base'
    static var boo: A.Member { StaticMember(.init(name: "boo")) } // error: Type of expression is ambiguous without more context
}
@belkadan
Copy link
Contributor

cc @xedin, @DougGregor

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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

2 participants