# Cycle errors report no source position information, making it impossible
# to locate the offending code.
# https://cuelang.org/issue/3118
-- in.cue --
#TimeSpan: {
	start:    float
	duration: float
	end:      float

	start:    end - duration
	duration: end - start
	end:      start + duration

	start: <=end
}

examples: [string]: #TimeSpan

examples: eg1: {
    start: 10.0
    duration: 2.1
    @test(eq, {start: 10.0, duration: 2.1, end: 12.1})
}

examples: eg2: {
    start: 10.0
    @test(eq, {
	start: _|_    @test(err, code=incomplete, pos=[-15:12, -17:12, -13:12])
	duration: _|_ @test(err, code=incomplete, pos=[-14:12, -17:12, -13:12])
	end: _|_      @test(err, code=incomplete, pos=[-14:12, -17:12, -13:12])
})
}

examples: eg3: {
    end: 10.0
    @test(eq, {
	end: _|_      @test(err, code=incomplete, pos=[-22:12, -28:12, -24:12, -20:9])
	start: _|_    @test(err, code=incomplete, pos=[-23:12, -28:12, -24:12, -20:9])
	duration: _|_ @test(err, code=incomplete, pos=[-23:12, -28:12, -24:12, -20:9])
})
}
-- out/errors.txt --
[incomplete] #TimeSpan.start: non-concrete value end for bound <=:
    ./in.cue:10:11
#TimeSpan.start: non-concrete value float in operand to -:
    ./in.cue:6:12
    ./in.cue:4:12
    ./in.cue:8:12
#TimeSpan.duration: non-concrete value float in operand to -:
    ./in.cue:7:12
    ./in.cue:4:12
    ./in.cue:8:12
[incomplete] #TimeSpan.start: non-concrete value end for bound <=:
    ./in.cue:10:11
#TimeSpan.duration: non-concrete value float in operand to -:
    ./in.cue:7:12
    ./in.cue:4:12
    ./in.cue:8:12
[incomplete] #TimeSpan.start: non-concrete value end for bound <=:
    ./in.cue:10:11
#TimeSpan.duration: non-concrete value float in operand to -:
    ./in.cue:7:12
    ./in.cue:4:12
    ./in.cue:8:12
[incomplete] examples.eg2.start: non-concrete value end for bound <=:
    ./in.cue:10:11
examples.eg2.start: non-concrete value float in operand to -:
    ./in.cue:6:12
    ./in.cue:4:12
    ./in.cue:8:12
examples.eg2.duration: non-concrete value float in operand to -:
    ./in.cue:7:12
    ./in.cue:4:12
    ./in.cue:8:12
[incomplete] examples.eg2.duration: non-concrete value float in operand to -:
    ./in.cue:7:12
    ./in.cue:4:12
    ./in.cue:8:12
[incomplete] examples.eg2.duration: non-concrete value float in operand to -:
    ./in.cue:7:12
    ./in.cue:4:12
    ./in.cue:8:12
[incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -:
    ./in.cue:7:12
    ./in.cue:2:12
    ./in.cue:6:12
    ./in.cue:10:9
examples.eg3.end: non-concrete value <=10.0 & float in operand to +:
    ./in.cue:8:12
    ./in.cue:2:12
    ./in.cue:6:12
    ./in.cue:10:9
[incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -:
    ./in.cue:7:12
    ./in.cue:2:12
    ./in.cue:6:12
    ./in.cue:10:9
[incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -:
    ./in.cue:7:12
    ./in.cue:2:12
    ./in.cue:6:12
    ./in.cue:10:9
-- out/eval/stats --
Leaks:  0
Freed:  18
Reused: 9
Allocs: 9
Retain: 0

Unifications: 18
Conjuncts:    47
Disjuncts:    0

NumCloseIDs: 3
