github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/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  -- out/eval --
    53  (struct){
    54    issue700: (struct){
    55      a: (struct){
    56        y: (string){ "y" }
    57      }
    58      test1: (int){ 1 }
    59      test2: ((int|string)){ |(*(string){ "y" }, (int){ 1 }) }
    60    }
    61    lookup: (struct){
    62      x: (struct){
    63        name: (string){ "Hello" }
    64      }
    65      y: (_|_){
    66        // [incomplete] lookup.y: undefined field: a:
    67        //     ./in.cue:13:14
    68      }
    69      ok1: (struct){
    70        name: (string){ "Hello" }
    71      }
    72      ok2: (struct){
    73        name: (string){ "Hello" }
    74      }
    75      ok3: (struct){
    76        name: (string){ "Hello" }
    77      }
    78      ok4: (struct){
    79        name: (string){ "Hello" }
    80      }
    81      ok5: (struct){
    82        name: (string){ "Hello" }
    83      }
    84      allFail1: (_|_){
    85        // [incomplete] lookup.allFail1: 1 errors in empty disjunction:
    86        // lookup.allFail1: undefined field: a:
    87        //     ./in.cue:20:14
    88      }
    89      allFail2: (_|_){
    90        // [incomplete] lookup.allFail2: 1 errors in empty disjunction:
    91        // lookup.allFail2: undefined field: a:
    92        //     ./in.cue:21:14
    93      }
    94    }
    95    func: (struct){
    96      s: (string){ string }
    97      ok1: (_|_){
    98        // [incomplete] func.ok1: 1 errors in empty disjunction:
    99        // func.ok1: non-concrete argument 0:
   100        //     ./in.cue:26:7
   101      }
   102    }
   103    issue782: (struct){
   104      a: (struct){
   105        inner: (string){ string }
   106        interpolation: (string){ "override" }
   107      }
   108      b: (struct){
   109        inner: (string){ string }
   110        interpolation: (string){ "override" }
   111      }
   112      c: (struct){
   113        inner: (string){ string }
   114        interpolation: (string){ "override" }
   115      }
   116      d: (struct){
   117        inner: (string){ string }
   118        interpolation: (string){ "override" }
   119      }
   120    }
   121  }
   122  -- out/compile --
   123  --- in.cue
   124  {
   125    issue700: {
   126      a: {
   127        y: "y"
   128      }
   129      test1: (*〈0;a〉.x|1)
   130      test2: (*〈0;a〉.y|1)
   131    }
   132    lookup: {
   133      x: {
   134        name: "Hello"
   135      }
   136      y: 〈0;x〉.a
   137      ok1: (*〈0;x〉.a|〈0;x〉)
   138      ok2: (〈0;x〉|*〈0;x〉.a)
   139      ok3: (〈0;x〉.a|*〈0;x〉)
   140      ok4: (*〈0;x〉|〈0;x〉.a)
   141      ok5: (〈0;x〉|〈0;x〉.a)
   142      ok5: (〈0;x〉.a|〈0;x〉)
   143      allFail1: (〈0;x〉.a|〈0;x〉.b)
   144      allFail2: (〈0;x〉.a|〈0;x〉.b)
   145    }
   146    func: {
   147      s: string
   148      ok1: (〈import;"encoding/yaml"〉.MarshalStream(〈0;s〉)|〈import;"encoding/yaml"〉.Marshal(〈0;s〉))
   149    }
   150    issue782: {
   151      a: {
   152        inner: string
   153        interpolation: (*"\(〈0;inner〉)"|string)
   154        interpolation: "override"
   155      }
   156      b: {
   157        inner: string
   158        interpolation: (string|*"\(〈0;inner〉)")
   159        interpolation: "override"
   160      }
   161      c: {
   162        inner: string
   163        interpolation: ("\(〈0;inner〉)"|string)
   164        interpolation: "override"
   165      }
   166      d: {
   167        inner: string
   168        interpolation: (string|"\(〈0;inner〉)")
   169        interpolation: "override"
   170      }
   171    }
   172  }