#inlinetest:exclude CUE source contains compile-time errors (try-clause syntax, missing
# references) which prevent the inline runner from compiling the source.
-- in.cue --
@experiment(try)

// Struct-form try must be the last clause
structFormNotLast: {
    try if true { x: 1 }
}

// ? marker outside try context
optionalOutsideTry: {
    a: 1
    b: a?
}

// ? marker in for clause source (outside try)
optionalInForSource: {
    a?: [1, 2, 3]
    for x in a? { "\(x)": x }
}

// ? marker in body of assignment-form try
optionalInAssignmentBody: {
    a: 1
    b: 2
    try y = a? { x: b? } else { fallback: 23 }
}

// Struct-form try must be the last clause
invalidUseOfOptional: {
    try { x: c? }
}

-- out/eval/stats --
Leaks:  0
Freed:  2
Reused: 2
Allocs: 0
Retain: 0

Unifications: 2
Conjuncts:    2
Disjuncts:    2

NumCloseIDs: 0
-- out/evalalpha --
structFormNotLast: struct-form try clause must be the last clause in a comprehension:
    ./in.cue:5:5
optionalOutsideTry.b: optional marker (?) is only valid within a try clause:
    ./in.cue:11:8
optionalInForSource: optional marker (?) is only valid within a try clause:
    ./in.cue:17:14
optionalInAssignmentBody.try[].x: optional marker (?) is only valid within a try clause:
    ./in.cue:24:21
invalidUseOfOptional.x: reference "c" not found:
    ./in.cue:29:14
-- diff/-out/evalalpha<==>+out/eval --
diff old new
--- old
+++ new
@@ -3,4 +3,8 @@
 optionalOutsideTry.b: optional marker (?) is only valid within a try clause:
     ./in.cue:11:8
 optionalInForSource: optional marker (?) is only valid within a try clause:
-    ./in.cue:16:14
+    ./in.cue:17:14
+optionalInAssignmentBody.try[].x: optional marker (?) is only valid within a try clause:
+    ./in.cue:24:21
+invalidUseOfOptional.x: reference "c" not found:
+    ./in.cue:29:14
-- out/eval --
structFormNotLast: struct-form try clause must be the last clause in a comprehension:
    ./in.cue:5:5
optionalOutsideTry.b: optional marker (?) is only valid within a try clause:
    ./in.cue:11:8
optionalInForSource: optional marker (?) is only valid within a try clause:
    ./in.cue:16:14
