
# Tests that a struct combining an open pattern constraint with close() correctly
# rejects fields not allowed by the close() constraint when unified with a value.
# https://cuelang.org/issue/271
-- in.cue --
#T: [_]: _
#T: close({"a": string})
x:  #T
x: {
	a: "hello" @test(eq, "hello")
	b: "foo"   @test(err, code=eval, contains="field not allowed", pos=[-5:5, 0:2])
}
-- out/errors.txt --
[eval] x.b: field not allowed:
    ./in.cue:1:5
    ./in.cue:6:2
-- out/eval/stats --
Leaks:  0
Freed:  14
Reused: 5
Allocs: 9
Retain: 0
Unifications: 10
Conjuncts:    20
Disjuncts:    0
NumCloseIDs: 3
-- out/diff-v2-v3.txt --
Positions: v3 reports fewer positions than v2 for the "field not allowed" error.
x.b: field not allowed:
     ./in.cue:1:5
-    ./in.cue:2:11
-    ./in.cue:3:5
     ./in.cue:6:2
 
No newline at end of right file.
