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-7604] cyclic metadata dependency detected, aborting #50146

Closed
swift-ci opened this issue May 4, 2018 · 1 comment
Closed

[SR-7604] cyclic metadata dependency detected, aborting #50146

swift-ci opened this issue May 4, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution runtime The Swift Runtime

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented May 4, 2018

Previous ID SR-7604
Radar None
Original Reporter BenLeggiero (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

macOS 10.12.6 (16G1314)
Xcode 9.2 (9C40b)
Swift 4.0

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug, RunTimeCrash, Runtime
Assignee None
Priority Medium

md5: 9c43e07ce0345f770944473bb30af927

relates to:

  • SR-3779 Program with struct nested in generic struct crashes because of “cyclic metadata dependency”

Issue Description:

SSCCE:

struct ResettableLazy<Value> {
    
    private var valueHolder: ValueHolder
    
    init(initializer: @escaping () -> Value) {
        valueHolder = .unset(initializer)
    }
    
    enum ValueHolder {
        case hasValue(Value, () -> Value)
        case unset(() -> Value)
    }
}



_ = ResettableLazy<String>() { "Crashes before this part runs" }

This works fine:

struct ResettableLazy<Value> {
    
    private var valueHolder: ValueHolder<Value>
    
    init(initializer: @escaping () -> Value) {
        valueHolder = .unset(initializer)
    }
}
    
enum ValueHolder<Value> {
    case hasValue(Value, () -> Value)
    case unset(() -> Value)
}



_ = ResettableLazy<String>() { "Runs just fine" }

Discovered when writing a StackOverflow answer

@belkadan
Copy link
Contributor

belkadan commented May 7, 2018

This was fixed in Swift 4.1.

@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. crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution runtime The Swift Runtime
Projects
None yet
Development

No branches or pull requests

3 participants