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-12801] Compiler crash on generic subscript AnyObject lookup #55246

Closed
hamishknight opened this issue May 13, 2020 · 1 comment
Closed

[SR-12801] Compiler crash on generic subscript AnyObject lookup #55246

hamishknight opened this issue May 13, 2020 · 1 comment
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software type checker Area → compiler: Semantic analysis

Comments

@hamishknight
Copy link
Collaborator

Previous ID SR-12801
Radar None
Original Reporter @hamishknight
Type Bug
Status Closed
Resolution Done
Environment

Swift version 5.3-dev (LLVM cb105ac, Swift fcd5def)
Target: x86_64-apple-darwin18.5.0

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

md5: 9c7f0d331b4c197bde27778a0659d75f

Issue Description:

The following hits an assertion in SIL verifier:

import Foundation

class C {
  @objc subscript<T>(foo : [T]) -> Int { return 0 }
}

func foob(_ x: AnyObject) {
  let c = x[[x]]
}
SIL verification failed: method must be @objc: DMBI->getMember().getDecl()->isObjC()
Verifying instruction:
     %3 = copy_value %2 : $@opened("221DCB2E-94C8-11EA-8199-E0D55EE4347B") AnyObject // users: %33, %15, %13
->   dynamic_method_br %3 : $@opened("221DCB2E-94C8-11EA-8199-E0D55EE4347B") AnyObject, #C.subscript!getter.foreign, bb1, bb2 // id: %13

But we should reject it in Sema as generic subscripts shouldn't be able to be marked @objc.

@hamishknight
Copy link
Collaborator Author

Fixed by #31753

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 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 crash Bug: A crash, i.e., an abnormal termination of software type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants