Skip to content

Unexpected structural cycle #4261

@YWalen

Description

@YWalen

I have two examples. Example 1:

#Inherit:  {
    #parent: _
    for k, v in #parent {
        if (v & {...}) != _|_ {
            (k): #Inherit & { #parent: v }
        }
        if (v & {...}) == _|_ {
            (k): *v | _
        }
    }
    ...
}

#layer1: {
    depth_1: {
        depth_2: {}
    }
}

layer_2: #Inherit & {
    #parent: #layer1
}

Example 2:

#Inherit:  {
    #parent: _
    for k, v in #parent {
        if (v & {...}) != _|_ {
            (k): #Inherit & { #parent: v }
        }
        if (v & {...}) == _|_ {
            (k): *v | _
        }
    }
    ...
}

#layer1: {
    depth_1: {
        depth_2: {
            depth_3: {}
        }
    }
}

layer_2: #Inherit & {
    #parent: #layer1
}

Example 1 works as expected but example 2 gives error:
layer_2.depth_1.depth_2.depth_3: structural cycle

Is this a bug or a feature? Is too much recursion not allowed in a for loop? I know this is not the intended way to use cue but I am trying something. Please let me know or educate me!

Metadata

Metadata

Assignees

No one assigned

    Labels

    TriageRequires triage/attention

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions