-- in.cue --
import "encoding/yaml"

issue700: {
	a: y: "y"
	test1: *a.x | 1
	test2: *a.y | 1
}

lookup: {
	x: {
		name: "Hello"
	}
	y:        x.a
	ok1:      *x.a | x
	ok2:      x | *x.a
	ok3:      x.a | *x
	ok4:      *x | x.a
	ok5:      x | x.a
	ok5:      x.a | x
	allFail1: x.a | x.b
	allFail2: x.a | x.b
}

func: {
	s:   string
	ok1: yaml.MarshalStream(s) | yaml.Marshal(s)
}

issue782: {
	a: {
		inner:         string
		interpolation: *"\(inner)" | string
		interpolation: "override"
	}
	b: {
		inner:         string
		interpolation: string | *"\(inner)"
		interpolation: "override"
	}
	c: {
		inner:         string
		interpolation: "\(inner)" | string
		interpolation: "override"
	}
	d: {
		inner:         string
		interpolation: string | "\(inner)"
		interpolation: "override"
	}
}
-- issue3680.cue --
issue3680: t1: {
	{} | {
		a?: _|_
		b?: _|_
	}
	{} | {}
}
issue3680: t2: {
	x:	{} | {
		a?: _|_
		b?: _|_
	}
	x:	{} | {}
}
-- out/eval/stats --
Leaks:  0
Freed:  98
Reused: 88
Allocs: 10
Retain: 0

Unifications: 56
Conjuncts:    132
Disjuncts:    98
-- out/eval --
(struct){
  issue700: (struct){
    a: (struct){
      y: (string){ "y" }
    }
    test1: (int){ 1 }
    test2: ((int|string)){ |(*(string){ "y" }, (int){ 1 }) }
  }
  lookup: (struct){
    x: (struct){
      name: (string){ "Hello" }
    }
    y: (_|_){
      // [incomplete] lookup.y: undefined field: a:
      //     ./in.cue:13:14
    }
    ok1: (struct){
      name: (string){ "Hello" }
    }
    ok2: (struct){
      name: (string){ "Hello" }
    }
    ok3: (struct){
      name: (string){ "Hello" }
    }
    ok4: (struct){
      name: (string){ "Hello" }
    }
    ok5: (struct){
      name: (string){ "Hello" }
    }
    allFail1: (_|_){
      // [incomplete] lookup.allFail1: 2 errors in empty disjunction:
      // lookup.allFail1: undefined field: a:
      //     ./in.cue:20:14
      // lookup.allFail1: undefined field: b:
      //     ./in.cue:20:20
    }
    allFail2: (_|_){
      // [incomplete] lookup.allFail2: 2 errors in empty disjunction:
      // lookup.allFail2: undefined field: a:
      //     ./in.cue:21:14
      // lookup.allFail2: undefined field: b:
      //     ./in.cue:21:20
    }
  }
  func: (struct){
    s: (string){ string }
    ok1: (_|_){
      // [incomplete] func.ok1: 2 errors in empty disjunction:
      // func.ok1: non-concrete argument 0:
      //     ./in.cue:26:7
      // func.ok1: non-concrete argument 0:
      //     ./in.cue:26:31
    }
  }
  issue782: (struct){
    a: (struct){
      inner: (string){ string }
      interpolation: (string){ "override" }
    }
    b: (struct){
      inner: (string){ string }
      interpolation: (string){ "override" }
    }
    c: (struct){
      inner: (string){ string }
      interpolation: (string){ "override" }
    }
    d: (struct){
      inner: (string){ string }
      interpolation: (string){ "override" }
    }
  }
  issue3680: (struct){
    t1: (struct){ |((struct){
      }, (struct){
        a?: (_|_){
          // [user] explicit error (_|_ literal) in source:
          //     ./issue3680.cue:3:7
        }
        b?: (_|_){
          // [user] explicit error (_|_ literal) in source:
          //     ./issue3680.cue:4:7
        }
      }) }
    t2: (struct){
      x: (struct){ |((struct){
        }, (struct){
          a?: (_|_){
            // [user] explicit error (_|_ literal) in source:
            //     ./issue3680.cue:10:7
          }
          b?: (_|_){
            // [user] explicit error (_|_ literal) in source:
            //     ./issue3680.cue:11:7
          }
        }) }
    }
  }
}
-- out/compile --
--- in.cue
{
  issue700: {
    a: {
      y: "y"
    }
    test1: (*〈0;a〉.x|1)
    test2: (*〈0;a〉.y|1)
  }
  lookup: {
    x: {
      name: "Hello"
    }
    y: 〈0;x〉.a
    ok1: (*〈0;x〉.a|〈0;x〉)
    ok2: (〈0;x〉|*〈0;x〉.a)
    ok3: (〈0;x〉.a|*〈0;x〉)
    ok4: (*〈0;x〉|〈0;x〉.a)
    ok5: (〈0;x〉|〈0;x〉.a)
    ok5: (〈0;x〉.a|〈0;x〉)
    allFail1: (〈0;x〉.a|〈0;x〉.b)
    allFail2: (〈0;x〉.a|〈0;x〉.b)
  }
  func: {
    s: string
    ok1: (〈import;"encoding/yaml"〉.MarshalStream(〈0;s〉)|〈import;"encoding/yaml"〉.Marshal(〈0;s〉))
  }
  issue782: {
    a: {
      inner: string
      interpolation: (*"\(〈0;inner〉)"|string)
      interpolation: "override"
    }
    b: {
      inner: string
      interpolation: (string|*"\(〈0;inner〉)")
      interpolation: "override"
    }
    c: {
      inner: string
      interpolation: ("\(〈0;inner〉)"|string)
      interpolation: "override"
    }
    d: {
      inner: string
      interpolation: (string|"\(〈0;inner〉)")
      interpolation: "override"
    }
  }
}
--- issue3680.cue
{
  issue3680: {
    t1: {
      ({}|{
        a?: _|_(explicit error (_|_ literal) in source)
        b?: _|_(explicit error (_|_ literal) in source)
      })
      ({}|{})
    }
  }
  issue3680: {
    t2: {
      x: ({}|{
        a?: _|_(explicit error (_|_ literal) in source)
        b?: _|_(explicit error (_|_ literal) in source)
      })
      x: ({}|{})
    }
  }
}
