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-9898] Non-requirement static members should be usable on protocol metatype #52304

Closed
dabrahams opened this issue Feb 10, 2019 · 1 comment
Labels
compiler The Swift compiler in itself improvement

Comments

@dabrahams
Copy link
Collaborator

Previous ID SR-9898
Radar None
Original Reporter @dabrahams
Type Improvement
Status Resolved
Resolution Invalid
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement
Assignee None
Priority Medium

md5: 7980cf230b8fad159efd1c9f32b104c7

Issue Description:

Seems to me there's no reason this shouldn't compile. Am I missing something?

protocol P {}
struct Q : P { }

extension P { 
    // Not implementing a requirement 
    static var x: P { return Q() }
}

func f(_ : P) {}
f(.x) // error: static member 'x' cannot be used on protocol metatype 'P.Protocol'
@belkadan
Copy link
Contributor

The compiler can't tell from the call site that the implementation of x doesn't contain something like print(self).

@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
compiler The Swift compiler in itself improvement
Projects
None yet
Development

No branches or pull requests

2 participants