-- in.cue --
@experiment(try)

// When the source expression has an error, the error propagates
// rather than triggering the else clause.

// Error in for source - else should NOT trigger
forSourceError: {
	@test(err, code=eval, pos=[2:11], contains="cannot range")
	for x in "not-a-list" { "\(x)": x } fallback { fallbackField: true }
}

// Error in if condition - else should NOT trigger
ifConditionError: {
	@test(err, code=eval, pos=[2:6, 2:14], contains="invalid operands")
	if ("not" + 1) { a: 1 } else { b: 2 }
}

// Bottom value in for source - else should NOT trigger
forSourceBottom: {
	@test(err, code=user, pos=[2:11], contains="explicit error")
	for x in _|_ { "\(x)": x } fallback { fallbackField: true }
}
-- out/errors.txt --
[eval] forSourceError: cannot range over "not-a-list" (found string, want list or struct):
    ./in.cue:9:11
[eval] ifConditionError: invalid operands "not" and 1 to '+' (type string and int):
    ./in.cue:15:6
    ./in.cue:15:14
[user] explicit error (_|_ literal) in source:
    ./in.cue:21:11
-- out/eval/stats --
Leaks:  1
Freed:  4
Reused: 0
Allocs: 5
Retain: 0

Unifications: 5
Conjuncts:    4
Disjuncts:    0

NumCloseIDs: 6
