cuelang.org/go@v0.13.0/internal/core/export/testdata/selfcontained/import.txtar (about)

     1  #inlineImports: true
     2  
     3  # TODO: slightly more correct is for _hidden_567475F3.a to be `b` and not resolve.
     4  
     5  -- cue.mod/module.cue --
     6  module: "mod.test/a"
     7  language: version: "v0.9.0"
     8  
     9  -- in.cue --
    10  import "mod.test/a/pkg"
    11  import "tool/exec"
    12  
    13  // Can be inlined.
    14  v: pkg.v.v
    15  
    16  // Do not simplify because of multiple usages of enclosing struct.
    17  x: pkg.a.b.c
    18  y: pkg.a.b
    19  
    20  // Cannot simplify because of definition.
    21  z: pkg.#Def.f
    22  
    23  // Two references to package, but since the second is a scalar, it can be
    24  // hoisted and only one reference remains. So there is still no need for
    25  // a helper.
    26  // TODO: fix this to eliminate the helper.
    27  w: pkg.w
    28  wa: pkg.w.a
    29  
    30  // Never expand builtin packages.
    31  run: exec.Run
    32  
    33  _hidden: int
    34  
    35  -- pkg/pkg.cue --
    36  package pkg
    37  
    38  v: v: { x: 3, y: x }
    39  
    40  a: b: c: { d: int }
    41  
    42  #Def: f: g: int
    43  
    44  w: {
    45  	a: _hidden
    46  	_hidden: {a: b} // Mangle this hidden field.
    47  	b: 1
    48  	x: {
    49  		_hidden2: _hidden
    50  		y: _hidden2
    51  	}
    52  }
    53  
    54  -- out/self/default --
    55  import (
    56  	"mod.test/a/pkg"
    57  	"tool/exec"
    58  )
    59  
    60  // Can be inlined.
    61  v: pkg.v.v
    62  
    63  // Do not simplify because of multiple usages of enclosing struct.
    64  x: pkg.a.b.c
    65  y: pkg.a.b
    66  
    67  // Cannot simplify because of definition.
    68  z: pkg.#Def.f
    69  
    70  // Two references to package, but since the second is a scalar, it can be
    71  // hoisted and only one reference remains. So there is still no need for
    72  // a helper.
    73  // TODO: fix this to eliminate the helper.
    74  w:  pkg.w
    75  wa: pkg.w.a
    76  
    77  // Never expand builtin packages.
    78  run:     exec.Run
    79  _hidden: int
    80  -- out/self/expand_imports --
    81  import "tool/exec"
    82  
    83  // Can be inlined.
    84  v: {
    85  	x: 3
    86  	y: x
    87  }
    88  
    89  // Do not simplify because of multiple usages of enclosing struct.
    90  x: B.c
    91  y: B
    92  
    93  // Cannot simplify because of definition.
    94  z: F.#x
    95  
    96  // Two references to package, but since the second is a scalar, it can be
    97  // hoisted and only one reference remains. So there is still no need for
    98  // a helper.
    99  // TODO: fix this to eliminate the helper.
   100  w:  W
   101  wa: W.a
   102  
   103  // Never expand builtin packages.
   104  run:     exec.Run
   105  _hidden: int
   106  
   107  //cue:path: "mod.test/a/pkg".a.b
   108  let B = {
   109  	c: {
   110  		d: int
   111  	}
   112  }
   113  
   114  //cue:path: "mod.test/a/pkg".#Def.f
   115  let F = {
   116  	#x: {
   117  		g: int
   118  	}
   119  }
   120  
   121  //cue:path: "mod.test/a/pkg".w
   122  let W = {
   123  	a: _hidden_567475F3
   124  	_hidden_567475F3: {
   125  		a: 1
   126  	}
   127  	b: 1
   128  	x: {
   129  		_hidden2_567475F3: _hidden_567475F3
   130  		y:                 _hidden2_567475F3
   131  	}
   132  }