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-5767] Unexpected cyclic metadata #48337

Closed
swift-ci opened this issue Aug 25, 2017 · 0 comments
Closed

[SR-5767] Unexpected cyclic metadata #48337

swift-ci opened this issue Aug 25, 2017 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-5767
Radar None
Original Reporter nikolai.ruhe (JIRA User)
Type Bug
Status Closed
Resolution Duplicate
Environment

Xcode 9 beta 6

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

md5: ccf67915caaeff6ac084aa9c7bf031cb

duplicates:

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

Issue Description:

public struct Cyclic<T> {
    enum Nested {
        case a(T), b
    }
 
    let state: Nested
 
    init(_ value: T) {
        state = .a(value)
    }
}
 
Cyclic(1)

This produces the following runtime error:

GenericCache(0x1174e4330): cyclic metadata dependency detected, aborting

I have a vary vague feeling why the nested (implicitly generic) enum somehow is responsible for the recursive type dependency.

On the other hand, the following code works as expected:

enum Outer<T> {
    case a(T), b
}

public struct Acyclic<T> {

    let state: Outer<T>

    init(_ value: T) {
        state = .a(value)
    }
}

let _ = Acyclic(1)

This makes me think the compiler should be able to solve the metadata dependency, at least in this simple case.

@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

1 participant