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-6816] Let protocols inherit from class types #49365

Closed
hamishknight opened this issue Jan 23, 2018 · 3 comments
Closed

[SR-6816] Let protocols inherit from class types #49365

hamishknight opened this issue Jan 23, 2018 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@hamishknight
Copy link
Collaborator

Previous ID SR-6816
Radar rdar://problem/34812895
Original Reporter @hamishknight
Type Bug
Status Closed
Resolution Duplicate
Environment

Apple Swift version 4.0.3 (swiftlang-900.0.74.1 clang-900.0.39.2)
Target: x86_64-apple-macosx10.9

Swift version 4.1-dev (LLVM db86aaee13, Clang c336c4829f, Swift 84e0d44253)
Target: x86_64-apple-darwin17.3.0

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug
Assignee @slavapestov
Priority Medium

md5: 10c48fa7b03391e3812af3c707d060f0

is duplicated by:

  • SR-7068 Casting concrete class to protocol with type constraint triggers runtime exception
  • SR-7393 Bad access crash surrounding self constraint on protocol
  • SR-7955 EXC_BAD_ACCESS while accessing property of a constrained protocol
  • SR-8011 The curious case of protocol with class conformance and casting…
  • SR-8032 Compiler doesn't recognise constraints defined by where clause
  • SR-8098 Compiler segfault on instantiating object from protocol Type that requires base class
  • SR-7048 Layout constraint warning or compilation error

relates to:

  • SR-7068 Casting concrete class to protocol with type constraint triggers runtime exception

Issue Description:

In Swift 4.0.3, the following crashes with EXC_BAD_ACCESS at runtime (looks like its being mis-compiled):

class Person {}

protocol Parent where Self : Person {
  func speak()
}

class GrandMotherPerson : Person, Parent {
  func speak() {}
}

let parent: Parent = GrandMotherPerson()
parent.speak()

In the latest dev snapshot, it triggers a compiler assertion instead:

TYPE MISMATCH IN ARGUMENT 0 OF APPLY AT expression at [/Users/Hamish/Desktop/main.swift:20:1 - line:20:14] RangeText="parent.speak()"
  argument value:   %27 = open_existential_addr immutable_access %23 : $*Parent to $*@opened("32F07EA8-0071-11E8-AFDA-DCA9047B1400") Parent // user: %28
  parameter type: $@opened("32F07EA8-0071-11E8-AFDA-DCA9047B1400") Parent
@swift-ci
Copy link
Collaborator

Comment by William Yu (JIRA)

comes from here - https://stackoverflow.com/questions/48407121/exc-bad-access-when-trying-to-call-function-on-prototype?noredirect=1#comment83809638_48407121

There's some confusion if it's related to SR-55

@belkadan
Copy link
Contributor

@swift-ci create

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Jul 23, 2019

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

No branches or pull requests

3 participants