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-5086] Cyclic metadata dependency error in generic type with nested enum with associated value of outer generic type #47662

Closed
swift-ci opened this issue Jun 3, 2017 · 2 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 run-time crash Bug → crash: Swift code crashed during execution runtime The Swift Runtime

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Jun 3, 2017

Previous ID SR-5086
Radar None
Original Reporter neightchan (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, RunTimeCrash, Runtime
Assignee None
Priority Medium

md5: e73a65761d1d79420e920b3b51d5415a

duplicates:

  • SR-5650 Remove parent field from type metadata

relates to:

  • SR-4732 "Tree" enum crashes at runtime "cyclic metadata dependency detected, aborting"

Issue Description:

The following code

struct Outer<T> {
    enum Inner {
        case none
        case one(T)
    }
    
    var o: Inner
    
    init() {
        o = .none
    }
}

let o = Outer<Int>()

yields the following runtime error

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

Editorializing:

The following code achieves the same result.

struct Outer<T> {
    typealias Inner = Outer_Inner<T>
    
    var o: Inner
    
    init() {
        o = .none
    }
}

enum Outer_Inner<T> {
    case none
    case one(T)
}

let o = Outer<Int>()

Why is the code with nested generics not "transformed into" the code without (up to renaming)?

@belkadan
Copy link
Contributor

belkadan commented Jun 5, 2017

The runtime metadata for types currently preserves nesting information, so that transformation isn't entirely equivalent. But yes, this should definitely be supported.

@belkadan
Copy link
Contributor

belkadan commented Jun 5, 2017

cc @rjmccall

@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 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