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-8695] Segmentation fault: 11 #51208

Closed
jeremyabannister opened this issue Sep 5, 2018 · 4 comments
Closed

[SR-8695] Segmentation fault: 11 #51208

jeremyabannister opened this issue Sep 5, 2018 · 4 comments
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-8695
Radar None
Original Reporter @jeremyabannister
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 4d4e085412d2c998e89ec5a8ce814482

Issue Description:

This code causes the compiler to crash:

protocol DefinesState {
  associatedtype State
}


protocol Reactive: DefinesState {
  typealias StateTransform<Input> = (Input, State)->(State)
  var state: State { get set }
}


class Reaction <Reactor: Reactive, Input> {
  var reactor: Reactor
  var stateTransform: Reactor.StateTransform<Input>?
  
  init (reactor: Reactor, stateTransform: Reactor.StateTransform<Input>?) {
    self.reactor = reactor
    self.stateTransform = stateTransform
  }
}
@belkadan
Copy link
Contributor

belkadan commented Sep 5, 2018

Hm, seems to work for me with Swift 4.2. What version of Swift are you using?

@jeremyabannister
Copy link
Author

@belkadan I'm using Swift 4.1. I just uploaded a video of the issue - perhaps though this has already been fixed in 4.2, which is great! Otherwise, let me know if there's any other info that would be helpful to you. And thank you for making Swift for the rest of us, it's really pretty great.

P.S. The error goes away for me if I change this:

init (reactor: Reactor, stateTransform: Reactor.StateTransform<Input>?)

{ self.reactor = reactor; self.stateTransform = stateTransform }

to this:

init (reactor: Reactor)

{ self.reactor = reactor }

@jeremyabannister
Copy link
Author

@belkadan Wait nevermind the upload failed because the file is too big (50MB) - is there a better way for me to send it to you?

@belkadan
Copy link
Contributor

belkadan commented Sep 6, 2018

I've reproduced the crash on Swift 4.1 too, so I think we can just call this fixed!

@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