...

Text file src/cuelang.org/go/cue/testdata/disjunctions/elimination.txtar

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

     1// Ensure that disjunction elimination is not done prematurely.
     2
     3// Issue #651
     4
     5-- in.cue --
     6import "struct"
     7
     8// Closedness checks should not be triggered too early, or with an improper
     9// subset of StructInfos. Blindly finalizing partial disjuncts will end up
    10// doing a closedness check with not all embeddings present, which can lead to
    11// a field being rejected prematurely.
    12//
    13// It should be recursively disabled.
    14disambiguateClosed: {
    15	b: #Def & a
    16	a: #Def
    17	#Def: {{x: true} | {y: true}}
    18}
    19
    20// Checks should never be disabled for field matching.
    21alwaysCheckMatchers1: {
    22	b: {[=~"^xxxx$"]: int} | null
    23	b: {c:            string} | null
    24	b: c: "yyyyy"
    25}
    26
    27alwaysCheckPatterns2: {
    28	a: #X
    29	a: b
    30
    31	b: #X
    32	b: c: "yyyyy"
    33
    34	#X: string | {
    35		c: string
    36		{[=~"^xxxx$"]: int}
    37	}
    38}
    39
    40nestedNonMonotonic: resolved: n1: {
    41	x: {a:    struct.MinFields(2)} | null
    42	x: {a: c: 1} | null
    43	x: {a: d: 1} | null
    44}
    45
    46nestedNonMonotonic: resolved: n2: {
    47	x: {a: b:    struct.MinFields(2)} | null
    48	x: {a: b: c: 1} | null
    49	x: {a: b: d: 1} | null
    50}
    51
    52nestedNonMonotonic: eliminated: n1: p1: {
    53	x: {a:    struct.MaxFields(1)} | null
    54	x: {a: c: 1} | null
    55	x: {a: d: 1} | null
    56}
    57
    58nestedNonMonotonic: eliminated: n1: p2: {
    59	x: {a: c: 1} | null
    60	x: {a:    struct.MaxFields(1)} | null
    61	x: {a: d: 1} | null
    62}
    63
    64nestedNonMonotonic: eliminated: n1: p2: {
    65	x: {a: c: 1} | null
    66	x: {a: d: 1} | null
    67	x: {a:    struct.MaxFields(1)} | null
    68}
    69
    70nestedNonMonotonic: eliminated: n2: p1: {
    71	x: {a: b:    struct.MaxFields(1)} | null
    72	x: {a: b: c: 1} | null
    73	x: {a: b: d: 1} | null
    74}
    75
    76nestedNonMonotonic: eliminated: n2: p2: {
    77	x: {a: b: c: 1} | null
    78	x: {a: b:    struct.MaxFields(1)} | null
    79	x: {a: b: d: 1} | null
    80}
    81
    82nestedNonMonotonic: eliminated: n2: p2: {
    83	x: {a: b: c: 1} | null
    84	x: {a: b: d: 1} | null
    85	x: {a: b:    struct.MaxFields(1)} | null
    86}
    87
    88// TODO: should be incomplete.
    89nestedNonMonotonic: incomplete: a: n1: p1: {
    90	x: {a:    struct.MinFields(2)} | null
    91	x: {a: c: 1} | null
    92}
    93
    94// TODO: should be incomplete.
    95nestedNonMonotonic: incomplete: a: n1: p2: {
    96	x: {a: c: 1} | null
    97	x: {a:    struct.MinFields(2)} | null
    98}
    99
   100nestedNonMonotonic: incomplete: a: n2: p1: {
   101	x: {a: b:    struct.MinFields(2)} | null
   102	x: {a: b: c: 1} | null
   103}
   104
   105nestedNonMonotonic: incomplete: a: n2: p2: {
   106	x: {a: b: c: 1} | null
   107	x: {a: b:    struct.MinFields(2)} | null
   108}
   109
   110nestedNonMonotonic: incomplete: b: n1: p1: {
   111	x: {a:    struct.MinFields(3)} | null
   112	x: {a: c: 1} | null
   113	x: {a: d: 1} | null
   114}
   115
   116nestedNonMonotonic: incomplete: b: n1: p2: {
   117	x: {a: c: 1} | null
   118	x: {a:    struct.MinFields(3)} | null
   119	x: {a: d: 1} | null
   120}
   121
   122nestedNonMonotonic: incomplete: b: n1: p3: {
   123	x: {a: c: 1} | null
   124	x: {a: d: 1} | null
   125	x: {a:    struct.MinFields(3)} | null
   126}
   127
   128nestedNonMonotonic: incomplete: b: n2: p1: {
   129	x: {a: b:    struct.MinFields(3)} | null
   130	x: {a: b: c: 1} | null
   131	x: {a: b: d: 1} | null
   132}
   133
   134nestedNonMonotonic: incomplete: b: n2: p1: {
   135	x: {a: b: c: 1} | null
   136	x: {a: b:    struct.MinFields(3)} | null
   137	x: {a: b: d: 1} | null
   138}
   139
   140nestedNonMonotonic: incomplete: b: n2: p1: {
   141	x: {a: b: c: 1} | null
   142	x: {a: b: d: 1} | null
   143	x: {a: b:    struct.MinFields(3)} | null
   144}
   145
   146preserveClosedness: small: p1: {
   147	#A: #B & {a: string}
   148	#B: {
   149		*{} | {a: string}
   150		*{} | {b: int}
   151	}
   152}
   153
   154preserveClosedness: small: p2: {
   155	#A: #B & {a: string}
   156	#B: {
   157		{a: string} | *{}
   158		*{} | {b: int}
   159	}
   160}
   161
   162preserveClosedness: medium: p1: {
   163	#A: #B & {a: string}
   164	#B: {
   165		*{} | {a: string} | {b: string}
   166		*{} | {c: int} | {d: string}
   167	}
   168}
   169
   170preserveClosedness: medium: p2: {
   171	#A: #B & {a: string}
   172	#B: {
   173		{a: string} | *{} | {b: string}
   174		*{} | {c: int} | {d: string}
   175	}
   176}
   177
   178preserveClosedness: medium: p3: {
   179	#A: #B & {a: string}
   180	#B: {
   181		{a: string} | {b: string} | *{}
   182		*{} | {c: int} | {d: string}
   183	}
   184}
   185
   186// If an error occurred in the last disjunction, it may sometimes be propagated
   187// to parent nodes. This, in turn, could lead to references to such field
   188// to fail with that error.
   189noChildError: _
   190noChildError: issue1608: {
   191	myValue: #type & {fieldName: "some string"}
   192	#type: fieldName: #subtype
   193
   194	#subtype: string | {foo: string} | {bar: #subtype}
   195}
   196
   197noChildError: t1: {
   198	#D: {b: string} | {c: #D }
   199	o: #D & {b: "test"}
   200}
   201
   202noChildError: t2: {
   203	o: #D & {b: "test"}
   204	#D: {b: string} | {c: #D }
   205}
   206
   207noChildError: t3: {
   208	#D: {a: null} | {b: string} | {c: #D }
   209	o: #D & {b: "test"}
   210}
   211
   212noChildError: t4: {
   213	o: #D & {b: "test"}
   214	#D: {a: null} | {b: string} | {c: #D }
   215}
   216
   217
   218issue1924: t1: {
   219	m: a: 2
   220	x: *[m.b] | 2
   221}
   222issue1924: t2: {
   223	m: a: 2
   224	x: *{v: m.b} | 3
   225}
   226issue1924: t3: {
   227	m: a: 2
   228	x: *m.b | 1
   229}
   230
   231// should eliminate erroneous comprehension and pass
   232issue1838: t1: {
   233	p?: []
   234	a: [for k in p {k}] | null
   235}
   236issue1838: t2: {
   237	p?: []
   238	a: null | [for k in p {k}]
   239}
   240
   241noHang: {
   242	// This should terminate.
   243	#T: ["a", #T] | ["d", ...#T]
   244
   245	x: #T
   246
   247	#X: x
   248	#X: #T
   249}
   250
   251issue1940: {
   252	#T: ["a", #T] | ["b", #T] | ["c", #T] | ["d", [...#T]]
   253
   254	#A: type: #T
   255
   256	#B: [string]: #A
   257
   258	#C: #B & {
   259		x: #A
   260	}
   261}
   262
   263-- issue2209full.cue --
   264// TODO: fix
   265
   266issue2209: simplified: t1: {
   267	#SpecFoo: foo: min: 1
   268	#SpecBar: bar: min: 1
   269	spec: bar: {}
   270	spec:  #SpecFoo | #SpecBar
   271	out: {
   272		{nullFoo: null} | {nullBar: null}
   273		{minFoo: int} | {minBar: int}
   274		if X.bar != _|_ {
   275			minBar: X.bar.min
   276		}
   277		X: spec
   278	}
   279}
   280
   281issue2209: simplified: t2: {
   282	#SpecFoo: foo: {}
   283	#SpecBar: bar: x: 1
   284	spec: bar: {}
   285	spec: *#SpecFoo | #SpecBar
   286	if spec.bar != _|_ {
   287		BAZ: spec.bar.x
   288	}
   289	{f1: int} | {b2: int}
   290	{f2: int} | {b2: int}
   291}
   292
   293// This test fails for 0.4 and 0.5.
   294issue2209: simplified: t3: {
   295	#A: v: 1
   296	{f1: int} | {b2: int}
   297	{f2: int} | {b2: int}
   298	BAZ: S.y
   299	S: *#A | #B
   300	#B: {x: 1, y: 1}
   301	S: x: 1
   302}
   303
   304issue2209: full: {
   305	Foo: #Abstract & {spec: foo: {}}
   306	Bar: #Abstract & {spec: bar: {}}
   307
   308	#Abstract: X={
   309		spec: _#Spec
   310
   311		resource: _Thing & {_X: spec: X.spec}
   312	}
   313
   314	_#Spec: *_#SpecFoo | _#SpecBar
   315
   316	_#SpecFoo: {
   317		foo: {
   318			min: int | *10
   319			max: int | *20
   320		}
   321	}
   322
   323	_#SpecBar: {
   324		bar: {
   325			min: int | *30
   326			max: int | *40
   327		}
   328	}
   329
   330	_Thing: #Constrained & {
   331		_X: _
   332
   333		spec: {
   334			if _X.spec.foo != _|_ {
   335				minFoo: _X.spec.foo.min
   336				maxFoo: _X.spec.foo.max
   337			}
   338
   339			if _X.spec.bar != _|_ {
   340				minBar: _X.spec.bar.min
   341				maxBar: _X.spec.bar.max
   342			}
   343		}
   344	}
   345
   346	#Constrained: #Base & {
   347		spec: {
   348			minFoo:  int | *10
   349			maxFoo:  int | *20
   350			minBar?: null
   351			maxBar?: null
   352		} | {
   353			minBar:  int | *30
   354			maxBar:  int | *40
   355			minFoo?: null
   356			maxFoo?: null
   357		}
   358
   359		spec: *{
   360			fuga?: null
   361		} | {
   362			hoge?: null
   363		}
   364	}
   365
   366	#Base: {
   367		spec: {
   368			minFoo?: null | int
   369			maxFoo?: null | int
   370			minBar?: null | int
   371			maxBar?: null | int
   372
   373			hoge?: null | bool
   374			fuga?: null | bool
   375		}
   376	}
   377}
   378
   379
   380-- issue2246.cue --
   381issue2246: simplified: {
   382	#FormFoo: fooID: string
   383	#FormBar: barID: string
   384	#Form: { #FormFoo | #FormBar }
   385
   386	data: {fooID: "123"}
   387	out1: #Form & data
   388	out2: #Form & out1
   389}
   390issue2246: full: {
   391	data: forms: [{
   392		fooID: "00-0000001"
   393	}]
   394
   395	form1040: (#compute & {in: data}).out
   396
   397	#K1: {
   398		#_base: common: 3
   399		#FormFoo: {
   400			#_base
   401			fooID: string
   402		}
   403		#FormBar: {
   404			#_base
   405			barID: string
   406		}
   407		#Form: {
   408			#FormFoo | #FormBar
   409		}
   410	}
   411
   412	#Input: {
   413		forms: [...#K1.#Form]
   414	}
   415
   416	#summarizeReturn: {
   417		in:  #Input
   418		out: [for k in in.forms { k.common }]
   419	}
   420
   421	#compute: {
   422		in:  #Input
   423		out: (#summarizeReturn & {"in": in}).out
   424	}
   425}
   426
   427-- issue2263.cue --
   428issue2263: simplified: {
   429	metrics: #Metric
   430	#Metric: {
   431		#IDSource | {}
   432		#TargetAverage | {}
   433	}
   434
   435	metrics: {
   436		id:  "foo"
   437		avg: 60
   438	}
   439
   440	#IDSource: id: string
   441	#TargetAverage: avg: number
   442}
   443issue2263: full: {
   444	metrics: [...#Metric]
   445
   446	metrics: [{
   447		id:  "foo"
   448		avg: 60
   449	}, {
   450		id:    "bar"
   451		value: 80
   452	}, {
   453		uri: "baz"
   454		avg: 70
   455	}, {
   456		uri:   "qux"
   457		value: 90
   458	}]
   459
   460	#Metric: {
   461		#Source
   462		#Target
   463	}
   464
   465	#Source:
   466		#IDSource |
   467		#URISource
   468
   469	#Target:
   470		#TargetAverage |
   471		#TargetValue
   472
   473	#IDSource: {
   474		id: string
   475	}
   476
   477	#URISource: {
   478		uri: string
   479	}
   480
   481	#TargetAverage: {
   482		avg: number
   483	}
   484
   485	#TargetValue: {
   486		value: number
   487	}
   488}
   489
   490-- out/eval/stats --
   491Leaks:  4
   492Freed:  2339
   493Reused: 2323
   494Allocs: 20
   495Retain: 115
   496
   497Unifications: 1260
   498Conjuncts:    3417
   499Disjuncts:    2454
   500-- out/eval --
   501Errors:
   502issue2209.full.Bar.resource.spec: 6 errors in empty disjunction:
   503issue2209.full.Bar.resource.spec.minBar: 2 errors in empty disjunction:
   504issue2209.full.Bar.resource.spec.minBar: conflicting values null and int (mismatched types null and int):
   505    ./issue2209full.cue:43:7
   506    ./issue2209full.cue:48:13
   507    ./issue2209full.cue:67:10
   508    ./issue2209full.cue:83:16
   509    ./issue2209full.cue:87:13
   510    ./issue2209full.cue:107:20
   511issue2209.full.Bar.resource.spec.minFoo: 2 errors in empty disjunction:
   512issue2209.full.Bar.resource.spec.minFoo: conflicting values null and 10 (mismatched types null and int):
   513    ./issue2209full.cue:43:7
   514    ./issue2209full.cue:48:13
   515    ./issue2209full.cue:55:16
   516    ./issue2209full.cue:71:4
   517    ./issue2209full.cue:72:13
   518    ./issue2209full.cue:92:13
   519issue2209.full.Bar.resource.spec.minFoo: conflicting values null and int (mismatched types null and int):
   520    ./issue2209full.cue:43:7
   521    ./issue2209full.cue:48:13
   522    ./issue2209full.cue:67:10
   523    ./issue2209full.cue:83:16
   524    ./issue2209full.cue:92:13
   525    ./issue2209full.cue:105:20
   526issue2209.simplified.t3.BAZ: undefined field: y:
   527    ./issue2209full.cue:35:9
   528issue2209.full.Bar.resource.spec.minBar: undefined field: min:
   529    ./issue2209full.cue:77:25
   530
   531Result:
   532(_|_){
   533  // [eval]
   534  disambiguateClosed: (struct){
   535    b: (#struct){ |((#struct){
   536        x: (bool){ true }
   537      }, (#struct){
   538        y: (bool){ true }
   539      }) }
   540    a: (#struct){ |((#struct){
   541        x: (bool){ true }
   542      }, (#struct){
   543        y: (bool){ true }
   544      }) }
   545    #Def: (#struct){ |((#struct){
   546        x: (bool){ true }
   547      }, (#struct){
   548        y: (bool){ true }
   549      }) }
   550  }
   551  alwaysCheckMatchers1: (struct){
   552    b: (struct){
   553      c: (string){ "yyyyy" }
   554    }
   555  }
   556  alwaysCheckPatterns2: (struct){
   557    a: (#struct){
   558      c: (string){ "yyyyy" }
   559    }
   560    b: (#struct){
   561      c: (string){ "yyyyy" }
   562    }
   563    #X: ((string|struct)){ |((string){ string }, (#struct){
   564        c: (string){ string }
   565      }) }
   566  }
   567  nestedNonMonotonic: (struct){
   568    resolved: (struct){
   569      n1: (struct){
   570        x: ((null|struct)){ |((struct){
   571            a: (struct){
   572              c: (int){ 1 }
   573              d: (int){ 1 }
   574            }
   575          }, (null){ null }) }
   576      }
   577      n2: (struct){
   578        x: ((null|struct)){ |((struct){
   579            a: (struct){
   580              b: (struct){
   581                c: (int){ 1 }
   582                d: (int){ 1 }
   583              }
   584            }
   585          }, (null){ null }) }
   586      }
   587    }
   588    eliminated: (struct){
   589      n1: (struct){
   590        p1: (struct){
   591          x: (null){ null }
   592        }
   593        p2: (struct){
   594          x: (null){ null }
   595        }
   596      }
   597      n2: (struct){
   598        p1: (struct){
   599          x: (null){ null }
   600        }
   601        p2: (struct){
   602          x: (null){ null }
   603        }
   604      }
   605    }
   606    incomplete: (struct){
   607      a: (struct){
   608        n1: (struct){
   609          p1: (struct){
   610            x: (null){ null }
   611          }
   612          p2: (struct){
   613            x: (null){ null }
   614          }
   615        }
   616        n2: (struct){
   617          p1: (struct){
   618            x: ((null|struct)){ |((struct){
   619                a: (struct){
   620                  b: (_|_){
   621                    // [incomplete] nestedNonMonotonic.incomplete.a.n2.p1.x.a.b: invalid value {c:1} (does not satisfy struct.MinFields(2)): len(fields) < MinFields(2) (1 < 2):
   622                    //     ./in.cue:96:15
   623                    //     ./in.cue:96:32
   624                    //     ./in.cue:97:12
   625                    c: (int){ 1 }
   626                  }
   627                }
   628              }, (null){ null }) }
   629          }
   630          p2: (struct){
   631            x: ((null|struct)){ |((struct){
   632                a: (struct){
   633                  b: (_|_){
   634                    // [incomplete] nestedNonMonotonic.incomplete.a.n2.p2.x.a.b: invalid value {c:1} (does not satisfy struct.MinFields(2)): len(fields) < MinFields(2) (1 < 2):
   635                    //     ./in.cue:102:15
   636                    //     ./in.cue:101:12
   637                    //     ./in.cue:102:32
   638                    c: (int){ 1 }
   639                  }
   640                }
   641              }, (null){ null }) }
   642          }
   643        }
   644      }
   645      b: (struct){
   646        n1: (struct){
   647          p1: (struct){
   648            x: (null){ null }
   649          }
   650          p2: (struct){
   651            x: (null){ null }
   652          }
   653          p3: (struct){
   654            x: (null){ null }
   655          }
   656        }
   657        n2: (struct){
   658          p1: (struct){
   659            x: ((null|struct)){ |((struct){
   660                a: (struct){
   661                  b: (_|_){
   662                    // [incomplete] nestedNonMonotonic.incomplete.b.n2.p1.x.a.b: invalid value {c:1 & 1 & 1,d:1 & 1 & 1} (does not satisfy struct.MinFields(3)): len(fields) < MinFields(3) (2 < 3):
   663                    //     ./in.cue:138:15
   664                    //     ./in.cue:124:15
   665                    //     ./in.cue:125:12
   666                    //     ./in.cue:126:12
   667                    //     ./in.cue:130:12
   668                    //     ./in.cue:131:15
   669                    //     ./in.cue:132:12
   670                    //     ./in.cue:136:12
   671                    //     ./in.cue:137:12
   672                    //     ./in.cue:138:32
   673                    c: (int){ 1 }
   674                    d: (int){ 1 }
   675                  }
   676                }
   677              }, (null){ null }) }
   678          }
   679        }
   680      }
   681    }
   682  }
   683  preserveClosedness: (struct){
   684    small: (struct){
   685      p1: (struct){
   686        #A: (#struct){ |(*(#struct){
   687            a: (string){ string }
   688          }, (#struct){
   689            a: (string){ string }
   690            b: (int){ int }
   691          }) }
   692        #B: (#struct){ |(*(#struct){
   693          }, (#struct){
   694            b: (int){ int }
   695          }, (#struct){
   696            a: (string){ string }
   697          }, (#struct){
   698            a: (string){ string }
   699            b: (int){ int }
   700          }) }
   701      }
   702      p2: (struct){
   703        #A: (#struct){ |(*(#struct){
   704            a: (string){ string }
   705          }, (#struct){
   706            a: (string){ string }
   707            b: (int){ int }
   708          }) }
   709        #B: (#struct){ |(*(#struct){
   710          }, (#struct){
   711            a: (string){ string }
   712            b: (int){ int }
   713          }, (#struct){
   714            a: (string){ string }
   715          }, (#struct){
   716            b: (int){ int }
   717          }) }
   718      }
   719    }
   720    medium: (struct){
   721      p1: (struct){
   722        #A: (#struct){ |(*(#struct){
   723            a: (string){ string }
   724          }, (#struct){
   725            a: (string){ string }
   726            c: (int){ int }
   727          }, (#struct){
   728            a: (string){ string }
   729            d: (string){ string }
   730          }) }
   731        #B: (#struct){ |(*(#struct){
   732          }, (#struct){
   733            c: (int){ int }
   734          }, (#struct){
   735            d: (string){ string }
   736          }, (#struct){
   737            a: (string){ string }
   738          }, (#struct){
   739            a: (string){ string }
   740            c: (int){ int }
   741          }, (#struct){
   742            a: (string){ string }
   743            d: (string){ string }
   744          }, (#struct){
   745            b: (string){ string }
   746          }, (#struct){
   747            b: (string){ string }
   748            c: (int){ int }
   749          }, (#struct){
   750            b: (string){ string }
   751            d: (string){ string }
   752          }) }
   753      }
   754      p2: (struct){
   755        #A: (#struct){ |(*(#struct){
   756            a: (string){ string }
   757          }, (#struct){
   758            a: (string){ string }
   759            c: (int){ int }
   760          }, (#struct){
   761            a: (string){ string }
   762            d: (string){ string }
   763          }) }
   764        #B: (#struct){ |(*(#struct){
   765          }, (#struct){
   766            a: (string){ string }
   767            c: (int){ int }
   768          }, (#struct){
   769            a: (string){ string }
   770            d: (string){ string }
   771          }, (#struct){
   772            a: (string){ string }
   773          }, (#struct){
   774            c: (int){ int }
   775          }, (#struct){
   776            d: (string){ string }
   777          }, (#struct){
   778            b: (string){ string }
   779          }, (#struct){
   780            b: (string){ string }
   781            c: (int){ int }
   782          }, (#struct){
   783            b: (string){ string }
   784            d: (string){ string }
   785          }) }
   786      }
   787      p3: (struct){
   788        #A: (#struct){ |(*(#struct){
   789            a: (string){ string }
   790          }, (#struct){
   791            a: (string){ string }
   792            c: (int){ int }
   793          }, (#struct){
   794            a: (string){ string }
   795            d: (string){ string }
   796          }) }
   797        #B: (#struct){ |(*(#struct){
   798          }, (#struct){
   799            a: (string){ string }
   800            c: (int){ int }
   801          }, (#struct){
   802            a: (string){ string }
   803            d: (string){ string }
   804          }, (#struct){
   805            b: (string){ string }
   806          }, (#struct){
   807            b: (string){ string }
   808            c: (int){ int }
   809          }, (#struct){
   810            b: (string){ string }
   811            d: (string){ string }
   812          }, (#struct){
   813            a: (string){ string }
   814          }, (#struct){
   815            c: (int){ int }
   816          }, (#struct){
   817            d: (string){ string }
   818          }) }
   819      }
   820    }
   821  }
   822  noChildError: (struct){
   823    issue1608: (struct){
   824      myValue: (#struct){
   825        fieldName: (string){ "some string" }
   826      }
   827      #type: (#struct){
   828        fieldName: ((string|struct)){ |((string){ string }, (#struct){
   829            foo: (string){ string }
   830          }, (#struct){
   831            bar: ((string|struct)){ |((string){ string }, (#struct){
   832                foo: (string){ string }
   833              }) }
   834          }) }
   835      }
   836      #subtype: ((string|struct)){ |((string){ string }, (#struct){
   837          foo: (string){ string }
   838        }) }
   839    }
   840    t1: (struct){
   841      #D: (#struct){
   842        b: (string){ string }
   843      }
   844      o: (#struct){
   845        b: (string){ "test" }
   846      }
   847    }
   848    t2: (struct){
   849      o: (#struct){
   850        b: (string){ "test" }
   851      }
   852      #D: (#struct){
   853        b: (string){ string }
   854      }
   855    }
   856    t3: (struct){
   857      #D: (#struct){ |((#struct){
   858          a: (null){ null }
   859        }, (#struct){
   860          b: (string){ string }
   861        }) }
   862      o: (#struct){
   863        b: (string){ "test" }
   864      }
   865    }
   866    t4: (struct){
   867      o: (#struct){
   868        b: (string){ "test" }
   869      }
   870      #D: (#struct){ |((#struct){
   871          a: (null){ null }
   872        }, (#struct){
   873          b: (string){ string }
   874        }) }
   875    }
   876  }
   877  issue1924: (struct){
   878    t1: (struct){
   879      m: (struct){
   880        a: (int){ 2 }
   881      }
   882      x: (int){ 2 }
   883    }
   884    t2: (struct){
   885      m: (struct){
   886        a: (int){ 2 }
   887      }
   888      x: (int){ 3 }
   889    }
   890    t3: (struct){
   891      m: (struct){
   892        a: (int){ 2 }
   893      }
   894      x: (int){ 1 }
   895    }
   896  }
   897  issue1838: (struct){
   898    t1: (struct){
   899      p?: (#list){
   900      }
   901      a: (null){ null }
   902    }
   903    t2: (struct){
   904      p?: (#list){
   905      }
   906      a: (null){ null }
   907    }
   908  }
   909  noHang: (struct){
   910    #T: (list){
   911      0: (string){ "d" }
   912    }
   913    x: (list){
   914      0: (string){ "d" }
   915    }
   916    #X: (list){
   917      0: (string){ "d" }
   918    }
   919  }
   920  issue1940: (struct){
   921    #T: (#list){
   922      0: (string){ "d" }
   923      1: (list){
   924      }
   925    }
   926    #A: (#struct){
   927      type: (#list){
   928        0: (string){ "d" }
   929        1: (list){
   930        }
   931      }
   932    }
   933    #B: (#struct){
   934    }
   935    #C: (#struct){
   936      x: (#struct){
   937        type: (#list){
   938          0: (string){ "d" }
   939          1: (list){
   940          }
   941        }
   942      }
   943    }
   944  }
   945  issue2209: (_|_){
   946    // [eval]
   947    simplified: (_|_){
   948      // [eval]
   949      t1: (struct){
   950        #SpecFoo: (#struct){
   951          foo: (#struct){
   952            min: (int){ 1 }
   953          }
   954        }
   955        #SpecBar: (#struct){
   956          bar: (#struct){
   957            min: (int){ 1 }
   958          }
   959        }
   960        spec: (#struct){
   961          bar: (#struct){
   962            min: (int){ 1 }
   963          }
   964        }
   965        out: (struct){ |((struct){
   966            X: (#struct){
   967              bar: (#struct){
   968                min: (int){ 1 }
   969              }
   970            }
   971            nullFoo: (null){ null }
   972            minFoo: (int){ int }
   973          }, (struct){
   974            minBar: (int){ int }
   975            X: (#struct){
   976              bar: (#struct){
   977                min: (int){ 1 }
   978              }
   979            }
   980            nullFoo: (null){ null }
   981          }, (struct){
   982            X: (#struct){
   983              bar: (#struct){
   984                min: (int){ 1 }
   985              }
   986            }
   987            nullBar: (null){ null }
   988            minFoo: (int){ int }
   989          }, (struct){
   990            minBar: (int){ int }
   991            X: (#struct){
   992              bar: (#struct){
   993                min: (int){ 1 }
   994              }
   995            }
   996            nullBar: (null){ null }
   997          }) }
   998      }
   999      t2: (_|_){
  1000        // [incomplete] issue2209.simplified.t2.BAZ: undefined field: x:
  1001        //     ./issue2209full.cue:24:17
  1002        #SpecFoo: (#struct){
  1003          foo: (#struct){
  1004          }
  1005        }
  1006        #SpecBar: (#struct){
  1007          bar: (#struct){
  1008            x: (int){ 1 }
  1009          }
  1010        }
  1011        spec: (#struct){ |(*(#struct){
  1012            bar: (struct){
  1013            }
  1014            foo: (#struct){
  1015            }
  1016          }, (#struct){
  1017            bar: (#struct){
  1018              x: (int){ 1 }
  1019            }
  1020          }) }
  1021        BAZ: (_|_){
  1022          // [incomplete] issue2209.simplified.t2.BAZ: undefined field: x:
  1023          //     ./issue2209full.cue:24:17
  1024        }
  1025        b2: (int){ int }
  1026      }
  1027      t3: (_|_){
  1028        // [eval] issue2209.simplified.t3.BAZ: undefined field: y:
  1029        //     ./issue2209full.cue:35:9
  1030        #A: (#struct){
  1031          v: (int){ 1 }
  1032        }
  1033        BAZ: (_|_){
  1034          // [eval] issue2209.simplified.t3.BAZ: undefined field: y:
  1035          //     ./issue2209full.cue:35:9
  1036        }
  1037        S: (#struct){ |(*(#struct){
  1038            x: (int){ 1 }
  1039            v: (int){ 1 }
  1040          }, (#struct){
  1041            x: (int){ 1 }
  1042            y: (int){ 1 }
  1043          }) }
  1044        #B: (#struct){
  1045          x: (int){ 1 }
  1046          y: (int){ 1 }
  1047        }
  1048        b2: (int){ int }
  1049      }
  1050    }
  1051    full: (_|_){
  1052      // [eval]
  1053      Foo: (#struct){
  1054        spec: (#struct){
  1055          foo: (#struct){
  1056            min: (int){ |(*(int){ 10 }, (int){ int }) }
  1057            max: (int){ |(*(int){ 20 }, (int){ int }) }
  1058          }
  1059        }
  1060        resource: (#struct){
  1061          spec: (#struct){ |(*(#struct){
  1062              minFoo: (int){ |(*(int){ 10 }, (int){ int }) }
  1063              maxFoo: (int){ |(*(int){ 20 }, (int){ int }) }
  1064              minBar?: (null){ null }
  1065              maxBar?: (null){ null }
  1066              hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1067              fuga?: (null){ null }
  1068            }, (#struct){
  1069              minFoo: (int){ |(*(int){ 10 }, (int){ int }) }
  1070              maxFoo: (int){ |(*(int){ 20 }, (int){ int }) }
  1071              minBar?: (null){ null }
  1072              maxBar?: (null){ null }
  1073              hoge?: (null){ null }
  1074              fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1075            }) }
  1076          _X: (#struct){
  1077            spec: (#struct){ |(*(#struct){
  1078                foo: (#struct){
  1079                  min: (int){ |(*(int){ 10 }, (int){ int }) }
  1080                  max: (int){ |(*(int){ 20 }, (int){ int }) }
  1081                }
  1082              }, (#struct){
  1083                foo: (#struct){
  1084                }
  1085                bar: (#struct){
  1086                  min: (int){ |(*(int){ 30 }, (int){ int }) }
  1087                  max: (int){ |(*(int){ 40 }, (int){ int }) }
  1088                }
  1089              }) }
  1090          }
  1091        }
  1092      }
  1093      Bar: (_|_){
  1094        // [eval]
  1095        spec: (#struct){
  1096          bar: (#struct){
  1097            min: (int){ |(*(int){ 30 }, (int){ int }) }
  1098            max: (int){ |(*(int){ 40 }, (int){ int }) }
  1099          }
  1100        }
  1101        resource: (_|_){
  1102          // [eval]
  1103          spec: (_|_){
  1104            // [eval] issue2209.full.Bar.resource.spec: 6 errors in empty disjunction:
  1105            // issue2209.full.Bar.resource.spec.minBar: 2 errors in empty disjunction:
  1106            // issue2209.full.Bar.resource.spec.minBar: conflicting values null and int (mismatched types null and int):
  1107            //     ./issue2209full.cue:43:7
  1108            //     ./issue2209full.cue:48:13
  1109            //     ./issue2209full.cue:67:10
  1110            //     ./issue2209full.cue:83:16
  1111            //     ./issue2209full.cue:87:13
  1112            //     ./issue2209full.cue:107:20
  1113            // issue2209.full.Bar.resource.spec.minFoo: 2 errors in empty disjunction:
  1114            // issue2209.full.Bar.resource.spec.minFoo: conflicting values null and 10 (mismatched types null and int):
  1115            //     ./issue2209full.cue:43:7
  1116            //     ./issue2209full.cue:48:13
  1117            //     ./issue2209full.cue:55:16
  1118            //     ./issue2209full.cue:71:4
  1119            //     ./issue2209full.cue:72:13
  1120            //     ./issue2209full.cue:92:13
  1121            // issue2209.full.Bar.resource.spec.minFoo: conflicting values null and int (mismatched types null and int):
  1122            //     ./issue2209full.cue:43:7
  1123            //     ./issue2209full.cue:48:13
  1124            //     ./issue2209full.cue:67:10
  1125            //     ./issue2209full.cue:83:16
  1126            //     ./issue2209full.cue:92:13
  1127            //     ./issue2209full.cue:105:20
  1128            // issue2209.full.Bar.resource.spec.minBar: undefined field: min:
  1129            //     ./issue2209full.cue:77:25
  1130            minFoo: (_|_){
  1131              // [eval] issue2209.full.Bar.resource.spec.minFoo: 2 errors in empty disjunction:
  1132              // issue2209.full.Bar.resource.spec.minFoo: conflicting values null and 10 (mismatched types null and int):
  1133              //     ./issue2209full.cue:43:7
  1134              //     ./issue2209full.cue:48:13
  1135              //     ./issue2209full.cue:55:16
  1136              //     ./issue2209full.cue:71:4
  1137              //     ./issue2209full.cue:72:13
  1138              //     ./issue2209full.cue:92:13
  1139              // issue2209.full.Bar.resource.spec.minFoo: conflicting values null and int (mismatched types null and int):
  1140              //     ./issue2209full.cue:43:7
  1141              //     ./issue2209full.cue:48:13
  1142              //     ./issue2209full.cue:67:10
  1143              //     ./issue2209full.cue:83:16
  1144              //     ./issue2209full.cue:92:13
  1145              //     ./issue2209full.cue:105:20
  1146            }
  1147            maxFoo: (_|_){
  1148              // [eval] issue2209.full.Bar.resource.spec.maxFoo: 2 errors in empty disjunction:
  1149              // issue2209.full.Bar.resource.spec.maxFoo: conflicting values null and 20 (mismatched types null and int):
  1150              //     ./issue2209full.cue:43:7
  1151              //     ./issue2209full.cue:48:13
  1152              //     ./issue2209full.cue:56:16
  1153              //     ./issue2209full.cue:71:4
  1154              //     ./issue2209full.cue:73:13
  1155              //     ./issue2209full.cue:93:13
  1156              // issue2209.full.Bar.resource.spec.maxFoo: conflicting values null and int (mismatched types null and int):
  1157              //     ./issue2209full.cue:43:7
  1158              //     ./issue2209full.cue:48:13
  1159              //     ./issue2209full.cue:67:10
  1160              //     ./issue2209full.cue:83:16
  1161              //     ./issue2209full.cue:93:13
  1162              //     ./issue2209full.cue:106:20
  1163            }
  1164            minBar: (_|_){
  1165              // [eval] issue2209.full.Bar.resource.spec.minBar: undefined field: min:
  1166              //     ./issue2209full.cue:77:25
  1167            }
  1168            maxBar: (_|_){
  1169              // [eval] issue2209.full.Bar.resource.spec.maxBar: undefined field: max:
  1170              //     ./issue2209full.cue:78:25
  1171            }
  1172            hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1173            fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1174          }
  1175          _X: (#struct){
  1176            spec: (#struct){ |(*(#struct){
  1177                bar: (#struct){
  1178                }
  1179                foo: (#struct){
  1180                  min: (int){ |(*(int){ 10 }, (int){ int }) }
  1181                  max: (int){ |(*(int){ 20 }, (int){ int }) }
  1182                }
  1183              }, (#struct){
  1184                bar: (#struct){
  1185                  min: (int){ |(*(int){ 30 }, (int){ int }) }
  1186                  max: (int){ |(*(int){ 40 }, (int){ int }) }
  1187                }
  1188              }) }
  1189          }
  1190        }
  1191      }
  1192      #Abstract: (#struct){
  1193        spec: (#struct){ |(*(#struct){
  1194            foo: (#struct){
  1195              min: (int){ |(*(int){ 10 }, (int){ int }) }
  1196              max: (int){ |(*(int){ 20 }, (int){ int }) }
  1197            }
  1198          }, (#struct){
  1199            bar: (#struct){
  1200              min: (int){ |(*(int){ 30 }, (int){ int }) }
  1201              max: (int){ |(*(int){ 40 }, (int){ int }) }
  1202            }
  1203          }) }
  1204        resource: (#struct){
  1205          spec: (#struct){ |(*(#struct){
  1206              minFoo: (int){ |(*(int){ 10 }, (int){ int }) }
  1207              maxFoo: (int){ |(*(int){ 20 }, (int){ int }) }
  1208              minBar?: (null){ null }
  1209              maxBar?: (null){ null }
  1210              hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1211              fuga?: (null){ null }
  1212            }, (#struct){
  1213              minFoo: (int){ |(*(int){ 10 }, (int){ int }) }
  1214              maxFoo: (int){ |(*(int){ 20 }, (int){ int }) }
  1215              minBar?: (null){ null }
  1216              maxBar?: (null){ null }
  1217              hoge?: (null){ null }
  1218              fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1219            }) }
  1220          _X: (#struct){
  1221            spec: (#struct){ |(*(#struct){
  1222                foo: (#struct){
  1223                  min: (int){ |(*(int){ 10 }, (int){ int }) }
  1224                  max: (int){ |(*(int){ 20 }, (int){ int }) }
  1225                }
  1226              }, (#struct){
  1227                bar: (#struct){
  1228                  min: (int){ |(*(int){ 30 }, (int){ int }) }
  1229                  max: (int){ |(*(int){ 40 }, (int){ int }) }
  1230                }
  1231              }) }
  1232          }
  1233        }
  1234      }
  1235      _#Spec: (#struct){ |(*(#struct){
  1236          foo: (#struct){
  1237            min: (int){ |(*(int){ 10 }, (int){ int }) }
  1238            max: (int){ |(*(int){ 20 }, (int){ int }) }
  1239          }
  1240        }, (#struct){
  1241          bar: (#struct){
  1242            min: (int){ |(*(int){ 30 }, (int){ int }) }
  1243            max: (int){ |(*(int){ 40 }, (int){ int }) }
  1244          }
  1245        }) }
  1246      _#SpecFoo: (#struct){
  1247        foo: (#struct){
  1248          min: (int){ |(*(int){ 10 }, (int){ int }) }
  1249          max: (int){ |(*(int){ 20 }, (int){ int }) }
  1250        }
  1251      }
  1252      _#SpecBar: (#struct){
  1253        bar: (#struct){
  1254          min: (int){ |(*(int){ 30 }, (int){ int }) }
  1255          max: (int){ |(*(int){ 40 }, (int){ int }) }
  1256        }
  1257      }
  1258      _Thing: (#struct){
  1259        spec: (#struct){ |(*(#struct){
  1260            minFoo: (int){ |(*(int){ 10 }, (int){ int }) }
  1261            maxFoo: (int){ |(*(int){ 20 }, (int){ int }) }
  1262            minBar?: (null){ null }
  1263            maxBar?: (null){ null }
  1264            hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1265            fuga?: (null){ null }
  1266          }, *(#struct){
  1267            minFoo?: (null){ null }
  1268            maxFoo?: (null){ null }
  1269            minBar: (int){ |(*(int){ 30 }, (int){ int }) }
  1270            maxBar: (int){ |(*(int){ 40 }, (int){ int }) }
  1271            hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1272            fuga?: (null){ null }
  1273          }, (#struct){
  1274            minFoo: (int){ |(*(int){ 10 }, (int){ int }) }
  1275            maxFoo: (int){ |(*(int){ 20 }, (int){ int }) }
  1276            minBar?: (null){ null }
  1277            maxBar?: (null){ null }
  1278            hoge?: (null){ null }
  1279            fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1280          }, (#struct){
  1281            minFoo?: (null){ null }
  1282            maxFoo?: (null){ null }
  1283            minBar: (int){ |(*(int){ 30 }, (int){ int }) }
  1284            maxBar: (int){ |(*(int){ 40 }, (int){ int }) }
  1285            hoge?: (null){ null }
  1286            fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1287          }) }
  1288        _X: (_){ _ }
  1289      }
  1290      #Constrained: (#struct){
  1291        spec: (#struct){ |(*(#struct){
  1292            minFoo: (int){ |(*(int){ 10 }, (int){ int }) }
  1293            maxFoo: (int){ |(*(int){ 20 }, (int){ int }) }
  1294            minBar?: (null){ null }
  1295            maxBar?: (null){ null }
  1296            hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1297            fuga?: (null){ null }
  1298          }, *(#struct){
  1299            minFoo?: (null){ null }
  1300            maxFoo?: (null){ null }
  1301            minBar: (int){ |(*(int){ 30 }, (int){ int }) }
  1302            maxBar: (int){ |(*(int){ 40 }, (int){ int }) }
  1303            hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1304            fuga?: (null){ null }
  1305          }, (#struct){
  1306            minFoo: (int){ |(*(int){ 10 }, (int){ int }) }
  1307            maxFoo: (int){ |(*(int){ 20 }, (int){ int }) }
  1308            minBar?: (null){ null }
  1309            maxBar?: (null){ null }
  1310            hoge?: (null){ null }
  1311            fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1312          }, (#struct){
  1313            minFoo?: (null){ null }
  1314            maxFoo?: (null){ null }
  1315            minBar: (int){ |(*(int){ 30 }, (int){ int }) }
  1316            maxBar: (int){ |(*(int){ 40 }, (int){ int }) }
  1317            hoge?: (null){ null }
  1318            fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1319          }) }
  1320      }
  1321      #Base: (#struct){
  1322        spec: (#struct){
  1323          minFoo?: ((null|int)){ |((null){ null }, (int){ int }) }
  1324          maxFoo?: ((null|int)){ |((null){ null }, (int){ int }) }
  1325          minBar?: ((null|int)){ |((null){ null }, (int){ int }) }
  1326          maxBar?: ((null|int)){ |((null){ null }, (int){ int }) }
  1327          hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1328          fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) }
  1329        }
  1330      }
  1331    }
  1332  }
  1333  issue2246: (struct){
  1334    simplified: (struct){
  1335      #FormFoo: (#struct){
  1336        fooID: (string){ string }
  1337      }
  1338      #FormBar: (#struct){
  1339        barID: (string){ string }
  1340      }
  1341      #Form: (#struct){ |((#struct){
  1342          fooID: (string){ string }
  1343        }, (#struct){
  1344          barID: (string){ string }
  1345        }) }
  1346      data: (struct){
  1347        fooID: (string){ "123" }
  1348      }
  1349      out1: (#struct){
  1350        fooID: (string){ "123" }
  1351      }
  1352      out2: (#struct){
  1353        fooID: (string){ "123" }
  1354      }
  1355    }
  1356    full: (struct){
  1357      data: (struct){
  1358        forms: (#list){
  1359          0: (struct){
  1360            fooID: (string){ "00-0000001" }
  1361          }
  1362        }
  1363      }
  1364      form1040: (#list){
  1365        0: (int){ 3 }
  1366      }
  1367      #K1: (#struct){
  1368        #_base: (#struct){
  1369          common: (int){ 3 }
  1370        }
  1371        #FormFoo: (#struct){
  1372          common: (int){ 3 }
  1373          fooID: (string){ string }
  1374        }
  1375        #FormBar: (#struct){
  1376          common: (int){ 3 }
  1377          barID: (string){ string }
  1378        }
  1379        #Form: (#struct){ |((#struct){
  1380            common: (int){ 3 }
  1381            fooID: (string){ string }
  1382          }, (#struct){
  1383            common: (int){ 3 }
  1384            barID: (string){ string }
  1385          }) }
  1386      }
  1387      #Input: (#struct){
  1388        forms: (list){
  1389        }
  1390      }
  1391      #summarizeReturn: (#struct){
  1392        in: (#struct){
  1393          forms: (list){
  1394          }
  1395        }
  1396        out: (#list){
  1397        }
  1398      }
  1399      #compute: (#struct){
  1400        in: (#struct){
  1401          forms: (list){
  1402          }
  1403        }
  1404        out: (#list){
  1405        }
  1406      }
  1407    }
  1408  }
  1409  issue2263: (struct){
  1410    simplified: (struct){
  1411      metrics: (#struct){
  1412        id: (string){ "foo" }
  1413        avg: (int){ 60 }
  1414      }
  1415      #Metric: (#struct){ |((#struct){
  1416          id: (string){ string }
  1417          avg: (number){ number }
  1418        }, (#struct){
  1419          id: (string){ string }
  1420        }, (#struct){
  1421          avg: (number){ number }
  1422        }, (#struct){
  1423        }) }
  1424      #IDSource: (#struct){
  1425        id: (string){ string }
  1426      }
  1427      #TargetAverage: (#struct){
  1428        avg: (number){ number }
  1429      }
  1430    }
  1431    full: (struct){
  1432      metrics: (#list){
  1433        0: (#struct){
  1434          id: (string){ "foo" }
  1435          avg: (int){ 60 }
  1436        }
  1437        1: (#struct){
  1438          id: (string){ "bar" }
  1439          value: (int){ 80 }
  1440        }
  1441        2: (#struct){
  1442          uri: (string){ "baz" }
  1443          avg: (int){ 70 }
  1444        }
  1445        3: (#struct){
  1446          uri: (string){ "qux" }
  1447          value: (int){ 90 }
  1448        }
  1449      }
  1450      #Metric: (#struct){ |((#struct){
  1451          id: (string){ string }
  1452          avg: (number){ number }
  1453        }, (#struct){
  1454          id: (string){ string }
  1455          value: (number){ number }
  1456        }, (#struct){
  1457          uri: (string){ string }
  1458          avg: (number){ number }
  1459        }, (#struct){
  1460          uri: (string){ string }
  1461          value: (number){ number }
  1462        }) }
  1463      #Source: (#struct){ |((#struct){
  1464          id: (string){ string }
  1465        }, (#struct){
  1466          uri: (string){ string }
  1467        }) }
  1468      #Target: (#struct){ |((#struct){
  1469          avg: (number){ number }
  1470        }, (#struct){
  1471          value: (number){ number }
  1472        }) }
  1473      #IDSource: (#struct){
  1474        id: (string){ string }
  1475      }
  1476      #URISource: (#struct){
  1477        uri: (string){ string }
  1478      }
  1479      #TargetAverage: (#struct){
  1480        avg: (number){ number }
  1481      }
  1482      #TargetValue: (#struct){
  1483        value: (number){ number }
  1484      }
  1485    }
  1486  }
  1487}
  1488-- out/compile --
  1489--- in.cue
  1490{
  1491  disambiguateClosed: {
  1492    b: (〈0;#Def〉 & 〈0;a〉)
  1493    a: 〈0;#Def〉
  1494    #Def: {
  1495      ({
  1496        x: true
  1497      }|{
  1498        y: true
  1499      })
  1500    }
  1501  }
  1502  alwaysCheckMatchers1: {
  1503    b: ({
  1504      [=~"^xxxx$"]: int
  1505    }|null)
  1506    b: ({
  1507      c: string
  1508    }|null)
  1509    b: {
  1510      c: "yyyyy"
  1511    }
  1512  }
  1513  alwaysCheckPatterns2: {
  1514    a: 〈0;#X〉
  1515    a: 〈0;b〉
  1516    b: 〈0;#X〉
  1517    b: {
  1518      c: "yyyyy"
  1519    }
  1520    #X: (string|{
  1521      c: string
  1522      {
  1523        [=~"^xxxx$"]: int
  1524      }
  1525    })
  1526  }
  1527  nestedNonMonotonic: {
  1528    resolved: {
  1529      n1: {
  1530        x: ({
  1531          a: 〈import;struct〉.MinFields(2)
  1532        }|null)
  1533        x: ({
  1534          a: {
  1535            c: 1
  1536          }
  1537        }|null)
  1538        x: ({
  1539          a: {
  1540            d: 1
  1541          }
  1542        }|null)
  1543      }
  1544    }
  1545  }
  1546  nestedNonMonotonic: {
  1547    resolved: {
  1548      n2: {
  1549        x: ({
  1550          a: {
  1551            b: 〈import;struct〉.MinFields(2)
  1552          }
  1553        }|null)
  1554        x: ({
  1555          a: {
  1556            b: {
  1557              c: 1
  1558            }
  1559          }
  1560        }|null)
  1561        x: ({
  1562          a: {
  1563            b: {
  1564              d: 1
  1565            }
  1566          }
  1567        }|null)
  1568      }
  1569    }
  1570  }
  1571  nestedNonMonotonic: {
  1572    eliminated: {
  1573      n1: {
  1574        p1: {
  1575          x: ({
  1576            a: 〈import;struct〉.MaxFields(1)
  1577          }|null)
  1578          x: ({
  1579            a: {
  1580              c: 1
  1581            }
  1582          }|null)
  1583          x: ({
  1584            a: {
  1585              d: 1
  1586            }
  1587          }|null)
  1588        }
  1589      }
  1590    }
  1591  }
  1592  nestedNonMonotonic: {
  1593    eliminated: {
  1594      n1: {
  1595        p2: {
  1596          x: ({
  1597            a: {
  1598              c: 1
  1599            }
  1600          }|null)
  1601          x: ({
  1602            a: 〈import;struct〉.MaxFields(1)
  1603          }|null)
  1604          x: ({
  1605            a: {
  1606              d: 1
  1607            }
  1608          }|null)
  1609        }
  1610      }
  1611    }
  1612  }
  1613  nestedNonMonotonic: {
  1614    eliminated: {
  1615      n1: {
  1616        p2: {
  1617          x: ({
  1618            a: {
  1619              c: 1
  1620            }
  1621          }|null)
  1622          x: ({
  1623            a: {
  1624              d: 1
  1625            }
  1626          }|null)
  1627          x: ({
  1628            a: 〈import;struct〉.MaxFields(1)
  1629          }|null)
  1630        }
  1631      }
  1632    }
  1633  }
  1634  nestedNonMonotonic: {
  1635    eliminated: {
  1636      n2: {
  1637        p1: {
  1638          x: ({
  1639            a: {
  1640              b: 〈import;struct〉.MaxFields(1)
  1641            }
  1642          }|null)
  1643          x: ({
  1644            a: {
  1645              b: {
  1646                c: 1
  1647              }
  1648            }
  1649          }|null)
  1650          x: ({
  1651            a: {
  1652              b: {
  1653                d: 1
  1654              }
  1655            }
  1656          }|null)
  1657        }
  1658      }
  1659    }
  1660  }
  1661  nestedNonMonotonic: {
  1662    eliminated: {
  1663      n2: {
  1664        p2: {
  1665          x: ({
  1666            a: {
  1667              b: {
  1668                c: 1
  1669              }
  1670            }
  1671          }|null)
  1672          x: ({
  1673            a: {
  1674              b: 〈import;struct〉.MaxFields(1)
  1675            }
  1676          }|null)
  1677          x: ({
  1678            a: {
  1679              b: {
  1680                d: 1
  1681              }
  1682            }
  1683          }|null)
  1684        }
  1685      }
  1686    }
  1687  }
  1688  nestedNonMonotonic: {
  1689    eliminated: {
  1690      n2: {
  1691        p2: {
  1692          x: ({
  1693            a: {
  1694              b: {
  1695                c: 1
  1696              }
  1697            }
  1698          }|null)
  1699          x: ({
  1700            a: {
  1701              b: {
  1702                d: 1
  1703              }
  1704            }
  1705          }|null)
  1706          x: ({
  1707            a: {
  1708              b: 〈import;struct〉.MaxFields(1)
  1709            }
  1710          }|null)
  1711        }
  1712      }
  1713    }
  1714  }
  1715  nestedNonMonotonic: {
  1716    incomplete: {
  1717      a: {
  1718        n1: {
  1719          p1: {
  1720            x: ({
  1721              a: 〈import;struct〉.MinFields(2)
  1722            }|null)
  1723            x: ({
  1724              a: {
  1725                c: 1
  1726              }
  1727            }|null)
  1728          }
  1729        }
  1730      }
  1731    }
  1732  }
  1733  nestedNonMonotonic: {
  1734    incomplete: {
  1735      a: {
  1736        n1: {
  1737          p2: {
  1738            x: ({
  1739              a: {
  1740                c: 1
  1741              }
  1742            }|null)
  1743            x: ({
  1744              a: 〈import;struct〉.MinFields(2)
  1745            }|null)
  1746          }
  1747        }
  1748      }
  1749    }
  1750  }
  1751  nestedNonMonotonic: {
  1752    incomplete: {
  1753      a: {
  1754        n2: {
  1755          p1: {
  1756            x: ({
  1757              a: {
  1758                b: 〈import;struct〉.MinFields(2)
  1759              }
  1760            }|null)
  1761            x: ({
  1762              a: {
  1763                b: {
  1764                  c: 1
  1765                }
  1766              }
  1767            }|null)
  1768          }
  1769        }
  1770      }
  1771    }
  1772  }
  1773  nestedNonMonotonic: {
  1774    incomplete: {
  1775      a: {
  1776        n2: {
  1777          p2: {
  1778            x: ({
  1779              a: {
  1780                b: {
  1781                  c: 1
  1782                }
  1783              }
  1784            }|null)
  1785            x: ({
  1786              a: {
  1787                b: 〈import;struct〉.MinFields(2)
  1788              }
  1789            }|null)
  1790          }
  1791        }
  1792      }
  1793    }
  1794  }
  1795  nestedNonMonotonic: {
  1796    incomplete: {
  1797      b: {
  1798        n1: {
  1799          p1: {
  1800            x: ({
  1801              a: 〈import;struct〉.MinFields(3)
  1802            }|null)
  1803            x: ({
  1804              a: {
  1805                c: 1
  1806              }
  1807            }|null)
  1808            x: ({
  1809              a: {
  1810                d: 1
  1811              }
  1812            }|null)
  1813          }
  1814        }
  1815      }
  1816    }
  1817  }
  1818  nestedNonMonotonic: {
  1819    incomplete: {
  1820      b: {
  1821        n1: {
  1822          p2: {
  1823            x: ({
  1824              a: {
  1825                c: 1
  1826              }
  1827            }|null)
  1828            x: ({
  1829              a: 〈import;struct〉.MinFields(3)
  1830            }|null)
  1831            x: ({
  1832              a: {
  1833                d: 1
  1834              }
  1835            }|null)
  1836          }
  1837        }
  1838      }
  1839    }
  1840  }
  1841  nestedNonMonotonic: {
  1842    incomplete: {
  1843      b: {
  1844        n1: {
  1845          p3: {
  1846            x: ({
  1847              a: {
  1848                c: 1
  1849              }
  1850            }|null)
  1851            x: ({
  1852              a: {
  1853                d: 1
  1854              }
  1855            }|null)
  1856            x: ({
  1857              a: 〈import;struct〉.MinFields(3)
  1858            }|null)
  1859          }
  1860        }
  1861      }
  1862    }
  1863  }
  1864  nestedNonMonotonic: {
  1865    incomplete: {
  1866      b: {
  1867        n2: {
  1868          p1: {
  1869            x: ({
  1870              a: {
  1871                b: 〈import;struct〉.MinFields(3)
  1872              }
  1873            }|null)
  1874            x: ({
  1875              a: {
  1876                b: {
  1877                  c: 1
  1878                }
  1879              }
  1880            }|null)
  1881            x: ({
  1882              a: {
  1883                b: {
  1884                  d: 1
  1885                }
  1886              }
  1887            }|null)
  1888          }
  1889        }
  1890      }
  1891    }
  1892  }
  1893  nestedNonMonotonic: {
  1894    incomplete: {
  1895      b: {
  1896        n2: {
  1897          p1: {
  1898            x: ({
  1899              a: {
  1900                b: {
  1901                  c: 1
  1902                }
  1903              }
  1904            }|null)
  1905            x: ({
  1906              a: {
  1907                b: 〈import;struct〉.MinFields(3)
  1908              }
  1909            }|null)
  1910            x: ({
  1911              a: {
  1912                b: {
  1913                  d: 1
  1914                }
  1915              }
  1916            }|null)
  1917          }
  1918        }
  1919      }
  1920    }
  1921  }
  1922  nestedNonMonotonic: {
  1923    incomplete: {
  1924      b: {
  1925        n2: {
  1926          p1: {
  1927            x: ({
  1928              a: {
  1929                b: {
  1930                  c: 1
  1931                }
  1932              }
  1933            }|null)
  1934            x: ({
  1935              a: {
  1936                b: {
  1937                  d: 1
  1938                }
  1939              }
  1940            }|null)
  1941            x: ({
  1942              a: {
  1943                b: 〈import;struct〉.MinFields(3)
  1944              }
  1945            }|null)
  1946          }
  1947        }
  1948      }
  1949    }
  1950  }
  1951  preserveClosedness: {
  1952    small: {
  1953      p1: {
  1954        #A: (〈0;#B〉 & {
  1955          a: string
  1956        })
  1957        #B: {
  1958          (*{}|{
  1959            a: string
  1960          })
  1961          (*{}|{
  1962            b: int
  1963          })
  1964        }
  1965      }
  1966    }
  1967  }
  1968  preserveClosedness: {
  1969    small: {
  1970      p2: {
  1971        #A: (〈0;#B〉 & {
  1972          a: string
  1973        })
  1974        #B: {
  1975          ({
  1976            a: string
  1977          }|*{})
  1978          (*{}|{
  1979            b: int
  1980          })
  1981        }
  1982      }
  1983    }
  1984  }
  1985  preserveClosedness: {
  1986    medium: {
  1987      p1: {
  1988        #A: (〈0;#B〉 & {
  1989          a: string
  1990        })
  1991        #B: {
  1992          (*{}|{
  1993            a: string
  1994          }|{
  1995            b: string
  1996          })
  1997          (*{}|{
  1998            c: int
  1999          }|{
  2000            d: string
  2001          })
  2002        }
  2003      }
  2004    }
  2005  }
  2006  preserveClosedness: {
  2007    medium: {
  2008      p2: {
  2009        #A: (〈0;#B〉 & {
  2010          a: string
  2011        })
  2012        #B: {
  2013          ({
  2014            a: string
  2015          }|*{}|{
  2016            b: string
  2017          })
  2018          (*{}|{
  2019            c: int
  2020          }|{
  2021            d: string
  2022          })
  2023        }
  2024      }
  2025    }
  2026  }
  2027  preserveClosedness: {
  2028    medium: {
  2029      p3: {
  2030        #A: (〈0;#B〉 & {
  2031          a: string
  2032        })
  2033        #B: {
  2034          ({
  2035            a: string
  2036          }|{
  2037            b: string
  2038          }|*{})
  2039          (*{}|{
  2040            c: int
  2041          }|{
  2042            d: string
  2043          })
  2044        }
  2045      }
  2046    }
  2047  }
  2048  noChildError: _
  2049  noChildError: {
  2050    issue1608: {
  2051      myValue: (〈0;#type〉 & {
  2052        fieldName: "some string"
  2053      })
  2054      #type: {
  2055        fieldName: 〈1;#subtype〉
  2056      }
  2057      #subtype: (string|{
  2058        foo: string
  2059      }|{
  2060        bar: 〈1;#subtype〉
  2061      })
  2062    }
  2063  }
  2064  noChildError: {
  2065    t1: {
  2066      #D: ({
  2067        b: string
  2068      }|{
  2069        c: 〈1;#D〉
  2070      })
  2071      o: (〈0;#D〉 & {
  2072        b: "test"
  2073      })
  2074    }
  2075  }
  2076  noChildError: {
  2077    t2: {
  2078      o: (〈0;#D〉 & {
  2079        b: "test"
  2080      })
  2081      #D: ({
  2082        b: string
  2083      }|{
  2084        c: 〈1;#D〉
  2085      })
  2086    }
  2087  }
  2088  noChildError: {
  2089    t3: {
  2090      #D: ({
  2091        a: null
  2092      }|{
  2093        b: string
  2094      }|{
  2095        c: 〈1;#D〉
  2096      })
  2097      o: (〈0;#D〉 & {
  2098        b: "test"
  2099      })
  2100    }
  2101  }
  2102  noChildError: {
  2103    t4: {
  2104      o: (〈0;#D〉 & {
  2105        b: "test"
  2106      })
  2107      #D: ({
  2108        a: null
  2109      }|{
  2110        b: string
  2111      }|{
  2112        c: 〈1;#D〉
  2113      })
  2114    }
  2115  }
  2116  issue1924: {
  2117    t1: {
  2118      m: {
  2119        a: 2
  2120      }
  2121      x: (*[
  2122        〈1;m〉.b,
  2123      ]|2)
  2124    }
  2125  }
  2126  issue1924: {
  2127    t2: {
  2128      m: {
  2129        a: 2
  2130      }
  2131      x: (*{
  2132        v: 〈1;m〉.b
  2133      }|3)
  2134    }
  2135  }
  2136  issue1924: {
  2137    t3: {
  2138      m: {
  2139        a: 2
  2140      }
  2141      x: (*〈0;m〉.b|1)
  2142    }
  2143  }
  2144  issue1838: {
  2145    t1: {
  2146      p?: []
  2147      a: ([
  2148        for _, k in 〈1;p〉 {
  2149          〈1;k〉
  2150        },
  2151      ]|null)
  2152    }
  2153  }
  2154  issue1838: {
  2155    t2: {
  2156      p?: []
  2157      a: (null|[
  2158        for _, k in 〈1;p〉 {
  2159          〈1;k〉
  2160        },
  2161      ])
  2162    }
  2163  }
  2164  noHang: {
  2165    #T: ([
  2166      "a",
  2167      〈1;#T〉,
  2168    ]|[
  2169      "d",
  2170      ...〈1;#T〉,
  2171    ])
  2172    x: 〈0;#T〉
  2173    #X: 〈0;x〉
  2174    #X: 〈0;#T〉
  2175  }
  2176  issue1940: {
  2177    #T: ([
  2178      "a",
  2179      〈1;#T〉,
  2180    ]|[
  2181      "b",
  2182      〈1;#T〉,
  2183    ]|[
  2184      "c",
  2185      〈1;#T〉,
  2186    ]|[
  2187      "d",
  2188      [
  2189        ...〈2;#T〉,
  2190      ],
  2191    ])
  2192    #A: {
  2193      type: 〈1;#T〉
  2194    }
  2195    #B: {
  2196      [string]: 〈1;#A〉
  2197    }
  2198    #C: (〈0;#B〉 & {
  2199      x: 〈1;#A〉
  2200    })
  2201  }
  2202}
  2203--- issue2209full.cue
  2204{
  2205  issue2209: {
  2206    simplified: {
  2207      t1: {
  2208        #SpecFoo: {
  2209          foo: {
  2210            min: 1
  2211          }
  2212        }
  2213        #SpecBar: {
  2214          bar: {
  2215            min: 1
  2216          }
  2217        }
  2218        spec: {
  2219          bar: {}
  2220        }
  2221        spec: (〈0;#SpecFoo〉|〈0;#SpecBar〉)
  2222        out: {
  2223          ({
  2224            nullFoo: null
  2225          }|{
  2226            nullBar: null
  2227          })
  2228          ({
  2229            minFoo: int
  2230          }|{
  2231            minBar: int
  2232          })
  2233          if (〈0;X〉.bar != _|_(explicit error (_|_ literal) in source)) {
  2234            minBar: 〈1;X〉.bar.min
  2235          }
  2236          X: 〈1;spec〉
  2237        }
  2238      }
  2239    }
  2240  }
  2241  issue2209: {
  2242    simplified: {
  2243      t2: {
  2244        #SpecFoo: {
  2245          foo: {}
  2246        }
  2247        #SpecBar: {
  2248          bar: {
  2249            x: 1
  2250          }
  2251        }
  2252        spec: {
  2253          bar: {}
  2254        }
  2255        spec: (*〈0;#SpecFoo〉|〈0;#SpecBar〉)
  2256        if (〈0;spec〉.bar != _|_(explicit error (_|_ literal) in source)) {
  2257          BAZ: 〈1;spec〉.bar.x
  2258        }
  2259        ({
  2260          f1: int
  2261        }|{
  2262          b2: int
  2263        })
  2264        ({
  2265          f2: int
  2266        }|{
  2267          b2: int
  2268        })
  2269      }
  2270    }
  2271  }
  2272  issue2209: {
  2273    simplified: {
  2274      t3: {
  2275        #A: {
  2276          v: 1
  2277        }
  2278        ({
  2279          f1: int
  2280        }|{
  2281          b2: int
  2282        })
  2283        ({
  2284          f2: int
  2285        }|{
  2286          b2: int
  2287        })
  2288        BAZ: 〈0;S〉.y
  2289        S: (*〈0;#A〉|〈0;#B〉)
  2290        #B: {
  2291          x: 1
  2292          y: 1
  2293        }
  2294        S: {
  2295          x: 1
  2296        }
  2297      }
  2298    }
  2299  }
  2300  issue2209: {
  2301    full: {
  2302      Foo: (〈0;#Abstract〉 & {
  2303        spec: {
  2304          foo: {}
  2305        }
  2306      })
  2307      Bar: (〈0;#Abstract〉 & {
  2308        spec: {
  2309          bar: {}
  2310        }
  2311      })
  2312      #Abstract: {
  2313        spec: 〈1;_#Spec〉
  2314        resource: (〈1;_Thing〉 & {
  2315          _X: {
  2316            spec: 〈3〉.spec
  2317          }
  2318        })
  2319      }
  2320      _#Spec: (*〈0;_#SpecFoo〉|〈0;_#SpecBar〉)
  2321      _#SpecFoo: {
  2322        foo: {
  2323          min: (int|*10)
  2324          max: (int|*20)
  2325        }
  2326      }
  2327      _#SpecBar: {
  2328        bar: {
  2329          min: (int|*30)
  2330          max: (int|*40)
  2331        }
  2332      }
  2333      _Thing: (〈0;#Constrained〉 & {
  2334        _X: _
  2335        spec: {
  2336          if (〈1;_X〉.spec.foo != _|_(explicit error (_|_ literal) in source)) {
  2337            minFoo: 〈2;_X〉.spec.foo.min
  2338            maxFoo: 〈2;_X〉.spec.foo.max
  2339          }
  2340          if (〈1;_X〉.spec.bar != _|_(explicit error (_|_ literal) in source)) {
  2341            minBar: 〈2;_X〉.spec.bar.min
  2342            maxBar: 〈2;_X〉.spec.bar.max
  2343          }
  2344        }
  2345      })
  2346      #Constrained: (〈0;#Base〉 & {
  2347        spec: ({
  2348          minFoo: (int|*10)
  2349          maxFoo: (int|*20)
  2350          minBar?: null
  2351          maxBar?: null
  2352        }|{
  2353          minBar: (int|*30)
  2354          maxBar: (int|*40)
  2355          minFoo?: null
  2356          maxFoo?: null
  2357        })
  2358        spec: (*{
  2359          fuga?: null
  2360        }|{
  2361          hoge?: null
  2362        })
  2363      })
  2364      #Base: {
  2365        spec: {
  2366          minFoo?: (null|int)
  2367          maxFoo?: (null|int)
  2368          minBar?: (null|int)
  2369          maxBar?: (null|int)
  2370          hoge?: (null|bool)
  2371          fuga?: (null|bool)
  2372        }
  2373      }
  2374    }
  2375  }
  2376}
  2377--- issue2246.cue
  2378{
  2379  issue2246: {
  2380    simplified: {
  2381      #FormFoo: {
  2382        fooID: string
  2383      }
  2384      #FormBar: {
  2385        barID: string
  2386      }
  2387      #Form: {
  2388        (〈1;#FormFoo〉|〈1;#FormBar〉)
  2389      }
  2390      data: {
  2391        fooID: "123"
  2392      }
  2393      out1: (〈0;#Form〉 & 〈0;data〉)
  2394      out2: (〈0;#Form〉 & 〈0;out1〉)
  2395    }
  2396  }
  2397  issue2246: {
  2398    full: {
  2399      data: {
  2400        forms: [
  2401          {
  2402            fooID: "00-0000001"
  2403          },
  2404        ]
  2405      }
  2406      form1040: (〈0;#compute〉 & {
  2407        in: 〈1;data〉
  2408      }).out
  2409      #K1: {
  2410        #_base: {
  2411          common: 3
  2412        }
  2413        #FormFoo: {
  2414          〈1;#_base〉
  2415          fooID: string
  2416        }
  2417        #FormBar: {
  2418          〈1;#_base〉
  2419          barID: string
  2420        }
  2421        #Form: {
  2422          (〈1;#FormFoo〉|〈1;#FormBar〉)
  2423        }
  2424      }
  2425      #Input: {
  2426        forms: [
  2427          ...〈2;#K1〉.#Form,
  2428        ]
  2429      }
  2430      #summarizeReturn: {
  2431        in: 〈1;#Input〉
  2432        out: [
  2433          for _, k in 〈1;in〉.forms {
  2434            〈1;k〉.common
  2435          },
  2436        ]
  2437      }
  2438      #compute: {
  2439        in: 〈1;#Input〉
  2440        out: (〈1;#summarizeReturn〉 & {
  2441          in: 〈1;in〉
  2442        }).out
  2443      }
  2444    }
  2445  }
  2446}
  2447--- issue2263.cue
  2448{
  2449  issue2263: {
  2450    simplified: {
  2451      metrics: 〈0;#Metric〉
  2452      #Metric: {
  2453        (〈1;#IDSource〉|{})
  2454        (〈1;#TargetAverage〉|{})
  2455      }
  2456      metrics: {
  2457        id: "foo"
  2458        avg: 60
  2459      }
  2460      #IDSource: {
  2461        id: string
  2462      }
  2463      #TargetAverage: {
  2464        avg: number
  2465      }
  2466    }
  2467  }
  2468  issue2263: {
  2469    full: {
  2470      metrics: [
  2471        ...〈1;#Metric〉,
  2472      ]
  2473      metrics: [
  2474        {
  2475          id: "foo"
  2476          avg: 60
  2477        },
  2478        {
  2479          id: "bar"
  2480          value: 80
  2481        },
  2482        {
  2483          uri: "baz"
  2484          avg: 70
  2485        },
  2486        {
  2487          uri: "qux"
  2488          value: 90
  2489        },
  2490      ]
  2491      #Metric: {
  2492        〈1;#Source〉
  2493        〈1;#Target〉
  2494      }
  2495      #Source: (〈0;#IDSource〉|〈0;#URISource〉)
  2496      #Target: (〈0;#TargetAverage〉|〈0;#TargetValue〉)
  2497      #IDSource: {
  2498        id: string
  2499      }
  2500      #URISource: {
  2501        uri: string
  2502      }
  2503      #TargetAverage: {
  2504        avg: number
  2505      }
  2506      #TargetValue: {
  2507        value: number
  2508      }
  2509    }
  2510  }
  2511}

View as plain text