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-7393] Bad access crash surrounding self constraint on protocol #49936

Closed
jeremyabannister opened this issue Apr 9, 2018 · 2 comments
Closed
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

Comments

@jeremyabannister
Copy link

Previous ID SR-7393
Radar rdar://problem/39316176
Original Reporter @jeremyabannister
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, CompilerCrash
Assignee @slavapestov
Priority Medium

md5: 1adc8e976310204f2b2373d94dccb850

duplicates:

  • SR-6816 Let protocols inherit from class types

Issue Description:

import UIKit

protocol A where Self: UIView { }
extension A {
  func method () {
    print("protocol A")
  }
}

protocol B: A { }
extension B {
  func method () {
    print("protocol B")
    (self as A).method() // EXC_BAD_ACCESS
  }
}

class X: UIView, B {
  func method () {
    print("class X")
    (self as B).method()
  }
}

let x = X()
x.method()

https://stackoverflow.com/questions/49662283/swift-bad-access-when-casting-to-protocol-with-self-constraint

@belkadan
Copy link
Contributor

@swift-ci create

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Jul 23, 2019

@jeremyabannister, Could you verify if the problem is fixed and if so move the JIRA to "Closed"?

Thanks!
Anna

@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
Projects
None yet
Development

No branches or pull requests

3 participants