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-10929] Property wrapper segmentation fault #53320

Closed
stephencelis opened this issue Jun 14, 2019 · 1 comment
Closed

[SR-10929] Property wrapper segmentation fault #53320

stephencelis opened this issue Jun 14, 2019 · 1 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 property wrappers Feature: property wrappers

Comments

@stephencelis
Copy link
Contributor

Previous ID SR-10929
Radar rdar://problem/51809986
Original Reporter @stephencelis
Type Bug
Status Resolved
Resolution Done
Environment

Xcode 11 (beta 1)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, PropertyWrappers
Assignee None
Priority Medium

md5: 3d06fbaf3e18ebe3c1efa989fee0f169

Issue Description:

  1. Create Xcode 11 single view app project with SwiftUI.

  2. Replace ContentView with the following:

import SwiftUI

@propertyWrapper public final class Store<Value, Action>: DynamicViewProperty, BindingConvertible {

  public let update: (inout Value, Action) -> Void
  public private(set) var value: Value

  public var binding: Binding<Value> {
    Binding<Value>(
      getValue: { self.value },
      setValue: { self.value = $0 }
    )
  }

  public init(_ initialValue: Value, _ update: @escaping (inout Value, Action) -> Void) {
    self.update = update
    self.value = initialValue
  }
}

enum Action {
  case increment
  case decrement
}

func update(_ state: inout Int, _ action: Action) {
  switch action {
  case .increment:
    state += 1
  case .decrement:
    state -= 1
  }
}

struct ContentView : View {
  @Store(0, update) var store

  var body: some View {
    Text("Hello World")
  }
}

#if DEBUG
struct ContentView_Previews : PreviewProvider {
  static var previews: some View {
    ContentView()
  }
}
#endif 
@DougGregor
Copy link
Member

Ah, this was fixed by #25215

@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 property wrappers Feature: property wrappers
Projects
None yet
Development

No branches or pull requests

3 participants