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

     1  #inlineImports: true
     2  
     3  -- cue.mod/module.cue --
     4  module: "mod.test/a"
     5  language: version: "v0.9.0"
     6  
     7  -- in.cue --
     8  import "mod.test/a/pkg"
     9  import "tool/exec"
    10  
    11  // Can be inlined.
    12  v: pkg.v.v
    13  
    14  // Do not simplify because of multiple usages of enclosing struct.
    15  x: pkg.a.b.c
    16  y: pkg.a.b
    17  
    18  // Cannot simplify because of definition.
    19  z: pkg.#Def.f
    20  
    21  // Two references to package, but since the second is a scalar, it can be
    22  // hoisted and only one reference remains. So there is still no need for
    23  // a helper.
    24  // TODO: fix this to eliminate the helper.
    25  w: pkg.w
    26  wa: pkg.w.a
    27  
    28  // Never expand builtin packages.
    29  run: exec.Run
    30  
    31  _hidden: int
    32  
    33  -- pkg/pkg.cue --
    34  package pkg
    35  
    36  v: v: { x: 3, y: x }
    37  
    38  a: b: c: { d: int }
    39  
    40  #Def: f: g: int
    41  
    42  w: {
    43  	a: _hidden
    44  	_hidden: {a: b} // Mangle this hidden field.
    45  	b: 1
    46  	x: {
    47  		_hidden2: _hidden
    48  		y: _hidden2
    49  	}
    50  }
    51  
    52  -- out/self/default --
    53  import (
    54  	"mod.test/a/pkg"
    55  	"tool/exec"
    56  )
    57  
    58  // Can be inlined.
    59  v: pkg.v.v
    60  
    61  // Do not simplify because of multiple usages of enclosing struct.
    62  x: pkg.a.b.c
    63  y: pkg.a.b
    64  
    65  // Cannot simplify because of definition.
    66  z: pkg.#Def.f
    67  
    68  // Two references to package, but since the second is a scalar, it can be
    69  // hoisted and only one reference remains. So there is still no need for
    70  // a helper.
    71  // TODO: fix this to eliminate the helper.
    72  w:  pkg.w
    73  wa: pkg.w.a
    74  
    75  // Never expand builtin packages.
    76  run:     exec.Run
    77  _hidden: int
    78  -- out/self-v3-noshare/expand_imports --
    79  import "tool/exec"
    80  
    81  // Can be inlined.
    82  v: V
    83  
    84  // Do not simplify because of multiple usages of enclosing struct.
    85  x: B.c
    86  y: B
    87  
    88  // Cannot simplify because of definition.
    89  z: F.#x
    90  
    91  // Two references to package, but since the second is a scalar, it can be
    92  // hoisted and only one reference remains. So there is still no need for
    93  // a helper.
    94  // TODO: fix this to eliminate the helper.
    95  w:  W
    96  wa: W.a
    97  
    98  // Never expand builtin packages.
    99  run:     exec.Run
   100  _hidden: int
   101  
   102  //cue:path: "mod.test/a/pkg".v.v
   103  let V = {
   104  	x: 3
   105  	y: x
   106  }
   107  
   108  //cue:path: "mod.test/a/pkg".a.b
   109  let B = {
   110  	c: {
   111  		d: int
   112  	}
   113  }
   114  
   115  //cue:path: "mod.test/a/pkg".#Def.f
   116  let F = {
   117  	#x: {
   118  		g: int
   119  	}
   120  }
   121  
   122  //cue:path: "mod.test/a/pkg".w
   123  let W = {
   124  	a: _hidden_567475F3
   125  	_hidden_567475F3: {
   126  		a: b
   127  	}
   128  	b: 1
   129  	x: {
   130  		_hidden2_567475F3: _hidden_567475F3
   131  		y:                 _hidden2_567475F3
   132  	}
   133  }
   134  -- diff/-out/self-v3-noshare/expand_imports<==>+out/self/expand_imports --
   135  diff old new
   136  --- old
   137  +++ new
   138  @@ -1,10 +1,7 @@
   139   import "tool/exec"
   140   
   141   // Can be inlined.
   142  -v: {
   143  -	x: 3
   144  -	y: x
   145  -}
   146  +v: V
   147   
   148   // Do not simplify because of multiple usages of enclosing struct.
   149   x: B.c
   150  @@ -24,6 +21,12 @@
   151   run:     exec.Run
   152   _hidden: int
   153   
   154  +//cue:path: "mod.test/a/pkg".v.v
   155  +let V = {
   156  +	x: 3
   157  +	y: x
   158  +}
   159  +
   160   //cue:path: "mod.test/a/pkg".a.b
   161   let B = {
   162   	c: {
   163  @@ -42,7 +45,7 @@
   164   let W = {
   165   	a: _hidden_567475F3
   166   	_hidden_567475F3: {
   167  -		a: 1
   168  +		a: b
   169   	}
   170   	b: 1
   171   	x: {
   172  -- diff/self/todo/p2 --
   173  Investigate differences.
   174  We assign p2, because the differences only appear with sharing off.
   175  -- out/self/expand_imports --
   176  import "tool/exec"
   177  
   178  // Can be inlined.
   179  v: {
   180  	x: 3
   181  	y: x
   182  }
   183  
   184  // Do not simplify because of multiple usages of enclosing struct.
   185  x: B.c
   186  y: B
   187  
   188  // Cannot simplify because of definition.
   189  z: F.#x
   190  
   191  // Two references to package, but since the second is a scalar, it can be
   192  // hoisted and only one reference remains. So there is still no need for
   193  // a helper.
   194  // TODO: fix this to eliminate the helper.
   195  w:  W
   196  wa: W.a
   197  
   198  // Never expand builtin packages.
   199  run:     exec.Run
   200  _hidden: int
   201  
   202  //cue:path: "mod.test/a/pkg".a.b
   203  let B = {
   204  	c: {
   205  		d: int
   206  	}
   207  }
   208  
   209  //cue:path: "mod.test/a/pkg".#Def.f
   210  let F = {
   211  	#x: {
   212  		g: int
   213  	}
   214  }
   215  
   216  //cue:path: "mod.test/a/pkg".w
   217  let W = {
   218  	a: _hidden_567475F3
   219  	_hidden_567475F3: {
   220  		a: 1
   221  	}
   222  	b: 1
   223  	x: {
   224  		_hidden2_567475F3: _hidden_567475F3
   225  		y:                 _hidden2_567475F3
   226  	}
   227  }