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

     1  -- in.cue --
     2  import "encoding/yaml"
     3  
     4  issue700: {
     5      a:y: "y"
     6      test1: *a.x | 1
     7      test2: *a.y | 1
     8  }
     9  
    10  lookup: {
    11      x: {
    12          name: "Hello"
    13      }
    14      y: x.a
    15      ok1:      *x.a  |  x
    16      ok2:       x    | *x.a
    17      ok3:       x.a  | *x
    18      ok4:      *x    |  x.a
    19      ok5:       x    |  x.a
    20      ok5:       x.a  |  x
    21      allFail1:  x.a  |  x.b
    22      allFail2:  x.a  |  x.b
    23  }
    24  
    25  func: {
    26      s: string
    27      ok1: yaml.MarshalStream(s) | yaml.Marshal(s)
    28  }
    29  
    30  issue782: {
    31      a: {
    32          inner:         string
    33          interpolation: *"\(inner)" | string
    34          interpolation: "override"
    35      }
    36      b: {
    37          inner:         string
    38          interpolation: string | *"\(inner)"
    39          interpolation: "override"
    40      }
    41      c: {
    42          inner:         string
    43          interpolation: "\(inner)" | string
    44          interpolation: "override"
    45      }
    46      d: {
    47          inner:         string
    48          interpolation: string | "\(inner)"
    49          interpolation: "override"
    50      }
    51  }
    52  
    53  -- out/eval --
    54  (struct){
    55    issue700: (struct){
    56      a: (struct){
    57        y: (string){ "y" }
    58      }
    59      test1: (int){ 1 }
    60      test2: ((int|string)){ |(*(string){ "y" }, (int){ 1 }) }
    61    }
    62    lookup: (struct){
    63      x: (struct){
    64        name: (string){ "Hello" }
    65      }
    66      y: (_|_){
    67        // [incomplete] lookup.y: undefined field: a:
    68        //     ./in.cue:13:10
    69      }
    70      ok1: (struct){
    71        name: (string){ "Hello" }
    72      }
    73      ok2: (struct){
    74        name: (string){ "Hello" }
    75      }
    76      ok3: (struct){
    77        name: (string){ "Hello" }
    78      }
    79      ok4: (struct){
    80        name: (string){ "Hello" }
    81      }
    82      ok5: (struct){
    83        name: (string){ "Hello" }
    84      }
    85      allFail1: (_|_){
    86        // [incomplete] lookup.allFail1: 1 errors in empty disjunction:
    87        // lookup.allFail1: undefined field: a:
    88        //     ./in.cue:20:18
    89      }
    90      allFail2: (_|_){
    91        // [incomplete] lookup.allFail2: 1 errors in empty disjunction:
    92        // lookup.allFail2: undefined field: a:
    93        //     ./in.cue:21:18
    94      }
    95    }
    96    func: (struct){
    97      s: (string){ string }
    98      ok1: (_|_){
    99        // [incomplete] func.ok1: 1 errors in empty disjunction:
   100        // func.ok1: non-concrete argument 0:
   101        //     ./in.cue:26:10
   102      }
   103    }
   104    issue782: (struct){
   105      a: (struct){
   106        inner: (string){ string }
   107        interpolation: (string){ "override" }
   108      }
   109      b: (struct){
   110        inner: (string){ string }
   111        interpolation: (string){ "override" }
   112      }
   113      c: (struct){
   114        inner: (string){ string }
   115        interpolation: (string){ "override" }
   116      }
   117      d: (struct){
   118        inner: (string){ string }
   119        interpolation: (string){ "override" }
   120      }
   121    }
   122  }
   123  -- out/compile --
   124  --- in.cue
   125  {
   126    issue700: {
   127      a: {
   128        y: "y"
   129      }
   130      test1: (*〈0;a〉.x|1)
   131      test2: (*〈0;a〉.y|1)
   132    }
   133    lookup: {
   134      x: {
   135        name: "Hello"
   136      }
   137      y: 〈0;x〉.a
   138      ok1: (*〈0;x〉.a|〈0;x〉)
   139      ok2: (〈0;x〉|*〈0;x〉.a)
   140      ok3: (〈0;x〉.a|*〈0;x〉)
   141      ok4: (*〈0;x〉|〈0;x〉.a)
   142      ok5: (〈0;x〉|〈0;x〉.a)
   143      ok5: (〈0;x〉.a|〈0;x〉)
   144      allFail1: (〈0;x〉.a|〈0;x〉.b)
   145      allFail2: (〈0;x〉.a|〈0;x〉.b)
   146    }
   147    func: {
   148      s: string
   149      ok1: (〈import;"encoding/yaml"〉.MarshalStream(〈0;s〉)|〈import;"encoding/yaml"〉.Marshal(〈0;s〉))
   150    }
   151    issue782: {
   152      a: {
   153        inner: string
   154        interpolation: (*"\(〈0;inner〉)"|string)
   155        interpolation: "override"
   156      }
   157      b: {
   158        inner: string
   159        interpolation: (string|*"\(〈0;inner〉)")
   160        interpolation: "override"
   161      }
   162      c: {
   163        inner: string
   164        interpolation: ("\(〈0;inner〉)"|string)
   165        interpolation: "override"
   166      }
   167      d: {
   168        inner: string
   169        interpolation: (string|"\(〈0;inner〉)")
   170        interpolation: "override"
   171      }
   172    }
   173  }