-
Notifications
You must be signed in to change notification settings - Fork 329
Closed
Labels
Description
# Without toposort.
env CUE_EXPERIMENT=evalv3=0,toposort=0
exec cue export input.cue
# With toposort.
env CUE_EXPERIMENT=evalv3=0,toposort=1
exec cue export input.cue
-- input.cue --
package p
#Exporter: {
_objects: {...}
_imports: [...]
objects: [
for _, objs in _objects {
objs
}
for import in _imports for obj in import._export.objects {
obj
}
]
}
out: #Exporter & {
_imports: [_app1]
}
_app1: {
_export: #Exporter & {
_imports: [_app2]
}
}
_app2: {
_export: #Exporter & {
_objects: leaf: leafField: "leaf value"
}
}
As of 870bfc2:
# Without toposort. (0.010s)
> env CUE_EXPERIMENT=evalv3=0,toposort=0
> exec cue export input.cue
[stdout]
{
"out": {
"objects": [
{
"leafField": "leaf value"
}
]
}
}
# With toposort. (0.361s)
> env CUE_EXPERIMENT=evalv3=0,toposort=1
> exec cue export input.cue
[stderr]
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc020610328 stack=[0xc020610000, 0xc040610000]
fatal error: stack overflow
runtime stack:
runtime.throw({0x109ea13?, 0x755b36f2cd38?})
/home/mvdan/tip/src/runtime/panic.go:1096 +0x48 fp=0x755b36f2cd08 sp=0x755b36f2ccd8 pc=0x47a9e8
runtime.newstack()
/home/mvdan/tip/src/runtime/stack.go:1107 +0x5bb fp=0x755b36f2ce40 sp=0x755b36f2cd08 pc=0x45e2db
runtime.morestack()
/home/mvdan/tip/src/runtime/asm_amd64.s:621 +0x7a fp=0x755b36f2ce48 sp=0x755b36f2ce40 pc=0x48095a
goroutine 1 gp=0xc000002380 m=8 mp=0xc000580008 [running]:
cuelang.org/go/cue/token.(*File).PositionFor(0xc0002601c0?, {0xc0002601c0?, 0xab3?}, 0x1?)
/home/mvdan/src/c/cue/cue/token/position.go:465 +0xdf fp=0xc020610338 sp=0xc020610330 pc=0x61537f
cuelang.org/go/cue/token.(*File).Position(...)
/home/mvdan/src/c/cue/cue/token/position.go:479
cuelang.org/go/cue/token.Pos.Position(...)
/home/mvdan/src/c/cue/cue/token/position.go:107
cuelang.org/go/cue/token.Pos.Filename({0xc0002601c0?, 0x0?})
/home/mvdan/src/c/cue/cue/token/position.go:100 +0x45 fp=0xc0206103b8 sp=0xc020610338 pc=0x613e25
cuelang.org/go/internal/core/toposort.(*vertexFeatures).addEdges(0xc04060e718, {0x0, 0x0, 0x0}, 0xc0004455a0)
/home/mvdan/src/c/cue/internal/core/toposort/vertex.go:454 +0x57 fp=0xc020610508 sp=0xc0206103b8 pc=0x7617f7
cuelang.org/go/internal/core/toposort.(*vertexFeatures).addEdges(0xc04060e718, {0x0, 0x0, 0x0}, 0xc0004455a0)
/home/mvdan/src/c/cue/internal/core/toposort/vertex.go:515 +0x83f fp=0xc020610658 sp=0xc020610508 pc=0x761fdf
cuelang.org/go/internal/core/toposort.(*vertexFeatures).addEdges(0xc04060e718, {0x0, 0x0, 0x0}, 0xc0004455a0)
/home/mvdan/src/c/cue/internal/core/toposort/vertex.go:515 +0x83f fp=0xc0206107a8 sp=0xc020610658 pc=0x761fdf
[...]