...

Text file src/cuelang.org/go/cue/testdata/compile/err_top.txtar

Documentation: cuelang.org/go/cue/testdata/compile

     1-- in.cue --
     2disallowTopAsAlias: {
     3	_=X: 1
     4}
     5
     6disallowTopAsLet: {
     7	let _ = 1
     8}
     9
    10disallowTopAsLabel: {
    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 --
    23disallowTopAsAlias: cannot use _ as alias or let clause:
    24    ./in.cue:2:2
    25disallowTopAsLet: cannot use _ as alias or let clause:
    26    ./in.cue:6:6
    27disallowTopAsLabel: 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 --
    43disallowTopAsAlias: cannot use _ as alias or let clause:
    44    ./in.cue:2:2
    45disallowTopAsLet: cannot use _ as alias or let clause:
    46    ./in.cue:6:6
    47disallowTopAsLabel: cannot use _ as label:
    48    ./in.cue:10:2

View as plain text