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-7953] Subscript with generic conformance crashes compiler #50488

Closed
iby opened this issue Jun 10, 2018 · 3 comments
Closed

[SR-7953] Subscript with generic conformance crashes compiler #50488

iby opened this issue Jun 10, 2018 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis

Comments

@iby
Copy link

iby commented Jun 10, 2018

Previous ID SR-7953
Radar rdar://problem/41027725
Original Reporter @iby
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, TypeChecker
Assignee @iby
Priority Medium

md5: 57e22cfe0891931312e683b0f1a5eb22

Issue Description:

This fails with an Error🙁25, 18) static member 'foo' cannot be used on protocol metatype '(ParentClass & Proto).Protocol' error:

@belkadan
Copy link
Contributor

No longer crashes in Swift 4.2, but the error message is pretty lousy:

<stdin>:25:16: error: cannot subscript a value of type 'Container' with an index of type '_'
_ = Container()[.foo]
    ~~~~~~~~~~~^~~~~~
<stdin>:15:5: note: found this candidate
    subscript<X: ParentClass & Proto>(x: X) -> Any? {
    ^

@xedin, is there a dup of this?

@xedin
Copy link
Member

xedin commented Jun 12, 2018

@swift-ci create

@hborla
Copy link
Member

hborla commented Feb 6, 2020

This is resolved in Swift 5.2. The compiler now reports

error: static member 'foo' cannot be used on protocol metatype '(ParentClass & Proto).Protocol'
_ = Container()[.foo]
~~~~~~~~~~~~~~~~~^~~~

Could you please verify using a recent 5.2 snapshot or the latest Xcode beta? Thank you!

@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 diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants