# Tests that string interpolation consistently detects references to
# non-existent fields. Issue: an interpolation with both a valid and an invalid
# field reference (e.g. "\(arg.x) \(arg.y)") silently swallowed the error for
# the invalid field, while a single invalid reference was correctly reported.
# https://cuelang.org/issue/318
#
-- in.cue --
#T: {
	arg: x: string
	out1: "\(arg.x) \(arg.y)" @test(err, code=eval)
	// TODO: is this really an eval error if it is referred to within a
	// definitions?
	out2: "\(arg.y)"           @test(err, code=eval)
	vx:   arg.x                @test(kind=string)
	vy:   arg.y                @test(err, code=eval)
}
-- out/errors.txt --
[eval] #T.out1: invalid interpolation: undefined field: y:
    ./in.cue:3:8
    ./in.cue:3:24
[eval] #T.out2: invalid interpolation: undefined field: y:
    ./in.cue:6:8
    ./in.cue:6:15
[eval] #T.vy: undefined field: y:
    ./in.cue:8:12
-- out/eval/stats --
Leaks:  0
Freed:  8
Reused: 4
Allocs: 4
Retain: 0

Unifications: 8
Conjuncts:    9
Disjuncts:    8
