# -- evalv2 --
env CUE_EXPERIMENT=evalv3=0
exec cue eval -e output main.cue
cmp stdout stdout.golden

# -- evalv3 --
env CUE_EXPERIMENT=evalv3=1
exec cue eval -e output main.cue
cmp stdout stdout.golden

-- cue.mod/module.cue --
module: "example.org/module@v0"
language: {
        version: "v0.9.0"
}
-- main.cue --
package main

import (
        "example.org/module/a_package"
)

output: a_package.level2
-- a_package/accountconfig.cue --
package a_package

// must be a structure to trigger the panic
#structure: {
        f:   string
}
#Level0: {
        structure?: #structure
}
#Level1: {
        #Level0
}
#Level2: {
        #Level1
        structure?: #structure
        if structure != _|_ {
                if settings.child != _|_ {
                        x: "x"
                }
        }
        settings: {
                child?: string
        }
}

level2: #Level2 & {
        structure: {
                f:   "a"
        }
}
-- stdout.golden --
structure: {
    f: "a"
}
settings: {}
