# Tests field visibility and comprehension iteration: comprehensions only iterate
# regular (non-optional, non-hidden, non-definition) fields; select and index access
# have different rules for optional, hidden, and definition fields. Issue #94.
-- in.cue --
foo: {
	opt?:    1
	"txt":   2
	#def:    3
	regular: 4
	_hidden: 5
}
comp: {for k, v in foo {"\(k)": v}}
select: {
	opt:     foo.opt
	"txt":   foo.txt
	#def:    foo.#def
	regular: foo.regular
	_hidden: foo._hidden
}
index: {
	opt:     foo["opt"]
	"txt":   foo["txt"]
	#def:    foo["#def"]
	regular: foo["regular"]
	_hidden: foo["_hidden"]
}
-- out/compile --
--- in.cue
{
  foo: {
    opt?: 1
    txt: 2
    #def: 3
    regular: 4
    _hidden: 5
  }
  comp: {
    for k, v in 〈1;foo〉 {
      "\(〈1;k〉)": 〈1;v〉
    }
  }
  select: {
    opt: 〈1;foo〉.opt
    txt: 〈1;foo〉.txt
    #def: 〈1;foo〉.#def
    regular: 〈1;foo〉.regular
    _hidden: 〈1;foo〉._hidden
  }
  index: {
    opt: 〈1;foo〉["opt"]
    txt: 〈1;foo〉["txt"]
    #def: 〈1;foo〉["#def"]
    regular: 〈1;foo〉["regular"]
    _hidden: 〈1;foo〉["_hidden"]
  }
}
