cuelang.org/go@v0.13.0/cue/testdata/eval/conjuncts.txtar (about)

     1  // These tests are related to issue 2351.
     2  
     3  -- in.cue --
     4  
     5  conjunct: t1: {
     6  	#early: *"X" | string
     7  	#early
     8  } & {
     9  	#early: *"X" | string
    10  	string
    11  }
    12  
    13  conjunct: t2: {
    14  	#early: *"X" | string
    15  	#early
    16  }
    17  conjunct: t2: {
    18  	#early: *"X" | string
    19  	string
    20  }
    21  
    22  // TODO: fix this test
    23  conjunct: t3: conjunct.t1 & conjunct.t2
    24  
    25  handleComprehensions: {
    26  	if false {
    27  		subs: #sub2 & 2
    28  	}
    29  	#sub2: 2
    30  }
    31  
    32  -- issue2351.cue --
    33  issue2351: let: {
    34  	let _param = "foo"
    35  	({
    36  		param: _param & [{}]
    37  		gen: [for p in param {p}]
    38  	}).gen
    39  }
    40  
    41  issue2351: hidden: {
    42  	_in1: ["foo"]
    43  	{
    44  		in2: _in1
    45  		out: [for x in in2 {x}]
    46  	}.out
    47  }
    48  
    49  -- issue2355.cue --
    50  issue2355: {
    51  	#GetF1: {
    52  		in:  _
    53  		out: in.f1
    54  	}
    55  
    56  	#PutOut1: {
    57  		in: _
    58  		out: out1: "\(in)"
    59  	}
    60  
    61  	export: {
    62  		let data = {f1: "foo"}
    63  		(#PutOut1 & {
    64  			in: (#GetF1 & {
    65  				in: data
    66  			}).out
    67  		}).out
    68  	}
    69  }
    70  
    71  -- out/evalalpha/stats --
    72  Leaks:  244
    73  Freed:  0
    74  Reused: 0
    75  Allocs: 244
    76  Retain: 0
    77  
    78  Unifications: 40
    79  Conjuncts:    254
    80  Disjuncts:    152
    81  
    82  CloseIDElems: 121
    83  NumCloseIDs: 48
    84  -- out/evalalpha --
    85  Errors:
    86  param: conflicting values [{}] and "foo" (mismatched types list and string):
    87      ./issue2351.cue:2:15
    88      ./issue2351.cue:4:19
    89  
    90  Result:
    91  (_|_){
    92    // [eval]
    93    conjunct: (struct){
    94      t1: (string){ |(*(string){
    95          "X"
    96          #early: (string){ |(*(string){ "X" }, (string){ string }) }
    97        }, (string){
    98          string
    99          #early: (string){ |(*(string){ "X" }, (string){ string }) }
   100        }) }
   101      t2: (string){ |(*(string){
   102          "X"
   103          #early: (string){ |(*(string){ "X" }, (string){ string }) }
   104        }, (string){
   105          string
   106          #early: (string){ |(*(string){ "X" }, (string){ string }) }
   107        }) }
   108      t3: (string){ |(*(string){
   109          "X"
   110          #early: (string){ |(*(string){ "X" }, (string){ string }) }
   111        }, (string){
   112          string
   113          #early: (string){ |(*(string){ "X" }, (string){ string }) }
   114        }) }
   115    }
   116    handleComprehensions: (struct){
   117      #sub2: (int){ 2 }
   118    }
   119    issue2351: (_|_){
   120      // [eval]
   121      let: (_|_){
   122        // [eval] param: conflicting values [{}] and "foo" (mismatched types list and string):
   123        //     ./issue2351.cue:2:15
   124        //     ./issue2351.cue:4:19
   125        let _param#1 = (string){ "foo" }
   126      }
   127      hidden: (#list){
   128        _in1: (#list){
   129          0: (string){ "foo" }
   130        }
   131        0: (string){ "foo" }
   132      }
   133    }
   134    issue2355: (struct){
   135      #GetF1: (#struct){
   136        in: (_){ _ }
   137        out: (_|_){
   138          // [incomplete] issue2355.#GetF1.out: in.f1 undefined as in is incomplete (type _):
   139          //     ./issue2355.cue:4:8
   140        }
   141      }
   142      #PutOut1: (#struct){
   143        in: (_){ _ }
   144        out: (#struct){
   145          out1: (_|_){
   146            // [incomplete] issue2355.#PutOut1.out.out1: invalid interpolation: non-concrete value _ (type _):
   147            //     ./issue2355.cue:9:14
   148          }
   149        }
   150      }
   151      export: (#struct){
   152        let data#2 = (struct){
   153          f1: (string){ "foo" }
   154        }
   155        out1: (string){ "foo" }
   156      }
   157    }
   158  }
   159  -- diff/-out/evalalpha/stats<==>+out/eval/stats --
   160  diff old new
   161  --- old
   162  +++ new
   163  @@ -1,9 +1,12 @@
   164  -Leaks:  9
   165  -Freed:  68
   166  -Reused: 59
   167  -Allocs: 18
   168  -Retain: 22
   169  -
   170  -Unifications: 45
   171  -Conjuncts:    135
   172  -Disjuncts:    86
   173  +Leaks:  244
   174  +Freed:  0
   175  +Reused: 0
   176  +Allocs: 244
   177  +Retain: 0
   178  +
   179  +Unifications: 40
   180  +Conjuncts:    254
   181  +Disjuncts:    152
   182  +
   183  +CloseIDElems: 121
   184  +NumCloseIDs: 48
   185  -- diff/-out/evalalpha<==>+out/eval --
   186  diff old new
   187  --- old
   188  +++ new
   189  @@ -1,7 +1,6 @@
   190   Errors:
   191  -issue2351.let.param: conflicting values "foo" and [{}] (mismatched types string and list):
   192  +param: conflicting values [{}] and "foo" (mismatched types list and string):
   193       ./issue2351.cue:2:15
   194  -    ./issue2351.cue:3:2
   195       ./issue2351.cue:4:19
   196   
   197   Result:
   198  @@ -22,14 +21,13 @@
   199           string
   200           #early: (string){ |(*(string){ "X" }, (string){ string }) }
   201         }) }
   202  -    t3: (_|_){
   203  -      // [incomplete] conjunct.t3: 2 errors in empty disjunction:
   204  -      // conjunct.t3: cannot add field #early: was already used:
   205  -      //     ./in.cue:6:2
   206  -      // conjunct.t3: cannot add field #early: was already used:
   207  -      //     ./in.cue:15:2
   208  -      #early: (string){ |(*(string){ "X" }, (string){ string }) }
   209  -    }
   210  +    t3: (string){ |(*(string){
   211  +        "X"
   212  +        #early: (string){ |(*(string){ "X" }, (string){ string }) }
   213  +      }, (string){
   214  +        string
   215  +        #early: (string){ |(*(string){ "X" }, (string){ string }) }
   216  +      }) }
   217     }
   218     handleComprehensions: (struct){
   219       #sub2: (int){ 2 }
   220  @@ -37,9 +35,8 @@
   221     issue2351: (_|_){
   222       // [eval]
   223       let: (_|_){
   224  -      // [eval] issue2351.let.param: conflicting values "foo" and [{}] (mismatched types string and list):
   225  +      // [eval] param: conflicting values [{}] and "foo" (mismatched types list and string):
   226         //     ./issue2351.cue:2:15
   227  -      //     ./issue2351.cue:3:2
   228         //     ./issue2351.cue:4:19
   229         let _param#1 = (string){ "foo" }
   230       }
   231  @@ -67,7 +64,7 @@
   232           }
   233         }
   234       }
   235  -    export: (struct){
   236  +    export: (#struct){
   237         let data#2 = (struct){
   238           f1: (string){ "foo" }
   239         }
   240  -- out/eval/stats --
   241  Leaks:  9
   242  Freed:  68
   243  Reused: 59
   244  Allocs: 18
   245  Retain: 22
   246  
   247  Unifications: 45
   248  Conjuncts:    135
   249  Disjuncts:    86
   250  -- diff/todo/p3 --
   251  Missing error position.
   252  -- diff/explanation --
   253  conjunct.t3: this used to be broken, but is now fixed.
   254  issue2355.export: correctly closing in new evaluator.
   255  -- out/eval --
   256  Errors:
   257  issue2351.let.param: conflicting values "foo" and [{}] (mismatched types string and list):
   258      ./issue2351.cue:2:15
   259      ./issue2351.cue:3:2
   260      ./issue2351.cue:4:19
   261  
   262  Result:
   263  (_|_){
   264    // [eval]
   265    conjunct: (struct){
   266      t1: (string){ |(*(string){
   267          "X"
   268          #early: (string){ |(*(string){ "X" }, (string){ string }) }
   269        }, (string){
   270          string
   271          #early: (string){ |(*(string){ "X" }, (string){ string }) }
   272        }) }
   273      t2: (string){ |(*(string){
   274          "X"
   275          #early: (string){ |(*(string){ "X" }, (string){ string }) }
   276        }, (string){
   277          string
   278          #early: (string){ |(*(string){ "X" }, (string){ string }) }
   279        }) }
   280      t3: (_|_){
   281        // [incomplete] conjunct.t3: 2 errors in empty disjunction:
   282        // conjunct.t3: cannot add field #early: was already used:
   283        //     ./in.cue:6:2
   284        // conjunct.t3: cannot add field #early: was already used:
   285        //     ./in.cue:15:2
   286        #early: (string){ |(*(string){ "X" }, (string){ string }) }
   287      }
   288    }
   289    handleComprehensions: (struct){
   290      #sub2: (int){ 2 }
   291    }
   292    issue2351: (_|_){
   293      // [eval]
   294      let: (_|_){
   295        // [eval] issue2351.let.param: conflicting values "foo" and [{}] (mismatched types string and list):
   296        //     ./issue2351.cue:2:15
   297        //     ./issue2351.cue:3:2
   298        //     ./issue2351.cue:4:19
   299        let _param#1 = (string){ "foo" }
   300      }
   301      hidden: (#list){
   302        _in1: (#list){
   303          0: (string){ "foo" }
   304        }
   305        0: (string){ "foo" }
   306      }
   307    }
   308    issue2355: (struct){
   309      #GetF1: (#struct){
   310        in: (_){ _ }
   311        out: (_|_){
   312          // [incomplete] issue2355.#GetF1.out: in.f1 undefined as in is incomplete (type _):
   313          //     ./issue2355.cue:4:8
   314        }
   315      }
   316      #PutOut1: (#struct){
   317        in: (_){ _ }
   318        out: (#struct){
   319          out1: (_|_){
   320            // [incomplete] issue2355.#PutOut1.out.out1: invalid interpolation: non-concrete value _ (type _):
   321            //     ./issue2355.cue:9:14
   322          }
   323        }
   324      }
   325      export: (struct){
   326        let data#2 = (struct){
   327          f1: (string){ "foo" }
   328        }
   329        out1: (string){ "foo" }
   330      }
   331    }
   332  }
   333  -- out/compile --
   334  --- in.cue
   335  {
   336    conjunct: {
   337      t1: ({
   338        #early: (*"X"|string)
   339        〈0;#early〉
   340      } & {
   341        #early: (*"X"|string)
   342        string
   343      })
   344    }
   345    conjunct: {
   346      t2: {
   347        #early: (*"X"|string)
   348        〈0;#early〉
   349      }
   350    }
   351    conjunct: {
   352      t2: {
   353        #early: (*"X"|string)
   354        string
   355      }
   356    }
   357    conjunct: {
   358      t3: (〈1;conjunct〉.t1 & 〈1;conjunct〉.t2)
   359    }
   360    handleComprehensions: {
   361      if false {
   362        subs: (〈1;#sub2〉 & 2)
   363      }
   364      #sub2: 2
   365    }
   366  }
   367  --- issue2351.cue
   368  {
   369    issue2351: {
   370      let: {
   371        let _param#1 = "foo"
   372        {
   373          param: (〈1;let _param#1〉 & [
   374            {},
   375          ])
   376          gen: [
   377            for _, p in 〈1;param〉 {
   378              〈1;p〉
   379            },
   380          ]
   381        }.gen
   382      }
   383    }
   384    issue2351: {
   385      hidden: {
   386        _in1: [
   387          "foo",
   388        ]
   389        {
   390          in2: 〈1;_in1〉
   391          out: [
   392            for _, x in 〈1;in2〉 {
   393              〈1;x〉
   394            },
   395          ]
   396        }.out
   397      }
   398    }
   399  }
   400  --- issue2355.cue
   401  {
   402    issue2355: {
   403      #GetF1: {
   404        in: _
   405        out: 〈0;in〉.f1
   406      }
   407      #PutOut1: {
   408        in: _
   409        out: {
   410          out1: "\(〈1;in〉)"
   411        }
   412      }
   413      export: {
   414        let data#2 = {
   415          f1: "foo"
   416        }
   417        (〈1;#PutOut1〉 & {
   418          in: (〈2;#GetF1〉 & {
   419            in: 〈2;let data#2〉
   420          }).out
   421        }).out
   422      }
   423    }
   424  }