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-11743] KeyPath Dynamic Member Lookup crash #54150

Closed
theblixguy opened this issue Nov 8, 2019 · 4 comments
Closed

[SR-11743] KeyPath Dynamic Member Lookup crash #54150

theblixguy opened this issue Nov 8, 2019 · 4 comments
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

@theblixguy
Copy link
Collaborator

Previous ID SR-11743
Radar rdar://problem/57091169
Original Reporter @theblixguy
Type Bug
Status Closed
Resolution Done
Environment

Swift version 5.1.1-dev (Swift fab6ce9)
Target: x86_64-apple-darwin19.0.0

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

md5: 16d67510fda064a927210bec377b346a

is duplicated by:

  • SR-12037 "Illegal instruction: 4" using dynamicMemberLookup with KeyPath

Issue Description:

@dynamicMemberLookup
protocol Foo {
  subscript(dynamicMember member: KeyPath<Self, Any>) -> Any { get }
}

extension Foo {
  subscript(dynamicMember member: KeyPath<Self, Any>) -> Any {
    self[keyPath: member]
  }
}

This code crashes when type checking self[keyPath: member]:

Assertion failed: ((path.size() == 1 && path[0].getKind() == ConstraintLocator::SubscriptMember) || (path.size() == 2 && path[1].getKind() == ConstraintLocator::KeyPathDynamicMember)), function addKeyPathApplicationRootConstraint, file /Users/suyashsrijan/Documents/swift-src/swift/lib/Sema/CSSimplify.cpp, line 8488.

Seems like there are 3 locator parts, which is triggering the assert:

[Subscript@/Users/suyashsrijan/Desktop/test.swift:8:7 -> subscript member -> key path dynamic member lookup -> key path dynamic member lookup]
@theblixguy
Copy link
Collaborator Author

cc @xedin

@beccadax
Copy link
Contributor

@swift-ci create

@xedin
Copy link
Member

xedin commented Feb 26, 2020

Problem has been addressed by #30040 @theblixguy please verify and close.

@theblixguy
Copy link
Collaborator Author

I have confirmed it no longer crashes on Swift version 5.2-dev (LLVM 6aa0c814b5, Swift 869e579477). Thank you @xedin for fixing it!

@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

4 participants