github.com/solo-io/cue@v0.4.7/doc/tutorial/basics/4_references/10_scopes.txt (about)

     1  cue eval scopes.cue
     2  cmp stdout expect-stdout-cue
     3  
     4  -- frontmatter.toml --
     5  title = "References and Scopes"
     6  description = ""
     7  
     8  -- text.md --
     9  A reference refers to the value of the field defined within the nearest
    10  enclosing scope.
    11  
    12  If no field matches the reference within the file, it may match a top-level
    13  field defined in any other file of the same package.
    14  
    15  If there is still no match, it may match a predefined value.
    16  
    17  -- scopes.cue --
    18  v: 1
    19  a: {
    20      v: 2
    21      b: v // matches the inner v
    22  }
    23  a: {
    24      c: v // matches the top-level v
    25  }
    26  b: v
    27  
    28  -- expect-stdout-cue --
    29  v: 1
    30  a: {
    31      v: 2
    32      b: 2
    33      c: 1
    34  }
    35  b: 1