-- 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: {
	for x in "not-a-list" {"\(x)": x} otherwise {fallbackField: true}
}

// Error in if condition - else should NOT trigger
ifConditionError: {
	if ("not" + 1) {a: 1} else {b: 2}
}

// Bottom value in for source - else should NOT trigger
forSourceBottom: {
	for x in _|_ {"\(x)": x} otherwise {fallbackField: true}
}
-- out/compile --
--- in.cue
{
  forSourceError: {
    for _, x in "not-a-list" {
      "\(〈1;x〉)": 〈1;x〉
    } else {
      fallbackField: true
    }
  }
  ifConditionError: {
    if ("not" + 1) {
      a: 1
    } else {
      b: 2
    }
  }
  forSourceBottom: {
    for _, x in _|_(explicit error (_|_ literal) in source) {
      "\(〈1;x〉)": 〈1;x〉
    } else {
      fallbackField: true
    }
  }
}
