File: for.txtar

package info (click to toggle)
golang-github-cue-lang-cue 0.14.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,644 kB
  • sloc: makefile: 20; sh: 15
file content (103 lines) | stat: -rw-r--r-- 1,430 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
-- in.cue --
b: {for k, v in a {"\(k)": v + 1}}
a: {b: 1, c: 2}

x: {for k, v in y {"\(k)": v}}
y: {} // check that empty struct after reference works.

k: {for v in e {v}}
e: int

comprehensionBinds: {
	a: {for _ in [1] {a: _}}
	b: {for _, _ in [1] {a: _}}
}
-- out/eval/stats --
Leaks:  2
Freed:  16
Reused: 12
Allocs: 6
Retain: 7

Unifications: 18
Conjuncts:    18
Disjuncts:    21

MisalignedConjunct: 1

NumCloseIDs: 5
-- out/eval --
Errors:
k: cannot range over e (found int, want list or struct):
    ./in.cue:7:14

Result:
(_|_){
  // [eval]
  b: (struct){
    b: (int){ 2 }
    c: (int){ 3 }
  }
  a: (struct){
    b: (int){ 1 }
    c: (int){ 2 }
  }
  x: (struct){
  }
  y: (struct){
  }
  k: (_|_){
    // [eval] k: cannot range over e (found int, want list or struct):
    //     ./in.cue:7:14
  }
  e: (int){ int }
  comprehensionBinds: (struct){
    a: (struct){
      a: (_){ _ }
    }
    b: (struct){
      a: (_){ _ }
    }
  }
}
-- out/compile --
--- in.cue
{
  b: {
    for k, v in 〈1;a〉 {
      "\(〈1;k〉)": (〈1;v〉 + 1)
    }
  }
  a: {
    b: 1
    c: 2
  }
  x: {
    for k, v in 〈1;y〉 {
      "\(〈1;k〉)": 〈1;v〉
    }
  }
  y: {}
  k: {
    for _, v in 〈1;e〉 {
      〈1;v〉
    }
  }
  e: int
  comprehensionBinds: {
    a: {
      for _, _ in [
        1,
      ] {
        a: _
      }
    }
    b: {
      for _, _ in [
        1,
      ] {
        a: _
      }
    }
  }
}