cuelang.org/go@v0.10.1/cue/testdata/compile/err_top.txtar (about)

     1  -- in.cue --
     2  disallowTopAsAlias: {
     3  	_=X: 1
     4  }
     5  
     6  disallowTopAsLet: {
     7  	let _ = 1
     8  }
     9  
    10  disallowTopAsLabel: {
    11  	_: 1
    12  	a: _ // Should not compile to a reference.
    13  }
    14  
    15  // TODO: disallow dollar as label? This is according to the spec, but it
    16  // will be a breaking change and $ was reserved for referring to the root of
    17  // a file, which we very likely will never implement.
    18  // disallowDollarAsLabel: {
    19  //   $: 1
    20  // }
    21  
    22  -- out/compile --
    23  disallowTopAsAlias: cannot use _ as alias or let clause:
    24      ./in.cue:2:2
    25  disallowTopAsLet: cannot use _ as alias or let clause:
    26      ./in.cue:6:6
    27  disallowTopAsLabel: cannot use _ as label:
    28      ./in.cue:10:2
    29  --- in.cue
    30  {
    31    disallowTopAsAlias: {
    32      X: 1
    33    }
    34    disallowTopAsLet: {
    35      let _ = 1
    36    }
    37    disallowTopAsLabel: {
    38      _|_(cannot use _ as label)
    39      a: _
    40    }
    41  }
    42  -- out/eval --
    43  disallowTopAsAlias: cannot use _ as alias or let clause:
    44      ./in.cue:2:2
    45  disallowTopAsLet: cannot use _ as alias or let clause:
    46      ./in.cue:6:6
    47  disallowTopAsLabel: cannot use _ as label:
    48      ./in.cue:10:2