github.com/solo-io/cue@v0.4.7/cue/testdata/definitions/issue271.txtar (about)

     1  -- in.cue --
     2  #T: [_]: _
     3  #T: close({"a": string})
     4  x: #T
     5  x: {
     6  	a: "hello"
     7  	b: "foo"
     8  }
     9  -- out/eval --
    10  Errors:
    11  x: field not allowed: b:
    12      ./in.cue:1:5
    13      ./in.cue:2:11
    14      ./in.cue:3:4
    15      ./in.cue:6:2
    16  
    17  Result:
    18  (_|_){
    19    // [eval]
    20    #T: (#struct){
    21      a: (string){ string }
    22    }
    23    x: (_|_){
    24      // [eval]
    25      a: (string){ "hello" }
    26      b: (_|_){
    27        // [eval] x: field not allowed: b:
    28        //     ./in.cue:1:5
    29        //     ./in.cue:2:11
    30        //     ./in.cue:3:4
    31        //     ./in.cue:6:2
    32      }
    33    }
    34  }
    35  -- out/compile --
    36  --- in.cue
    37  {
    38    #T: {
    39      [_]: _
    40    }
    41    #T: close({
    42      a: string
    43    })
    44    x: 〈0;#T〉
    45    x: {
    46      a: "hello"
    47      b: "foo"
    48    }
    49  }