Skip to content

Infinite Loop in compiler when hiding a cyclic dependency with polymorphism #4847

Open
@MrMetube

Description

@MrMetube

Context

    Odin:    dev-2025-02:584fdc0d4
    OS:      Windows 11 Professional (version: 24H2), build 26100.3194
    CPU:     12th Gen Intel(R) Core(TM) i5-12600
    RAM:     32540 MiB
    Backend: LLVM 18.1.8

Current Behavior

The compiler enters an infinite loop, when hiding a cyclic type definition inside a polymorphic struct.
It can already detect the cyclic dependency if we do not wrap the CyclicType and just use an alias or the type directly in its own definition.

Reproduction

package repro

Wrapper :: struct($T: typeid) {
    data: T,
}

CyclicType :: struct { 
    it: Wrapper(CyclicType),
}

// Also happens with union
CyclicUnion :: union { 
    f32,
    Wrapper(CyclicUnion),
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions