@sdboyer/thema-ui 0.0.0-bootstrap.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +24 -1
  3. package/dist/Diagnostics.d.ts +8 -0
  4. package/dist/Diagnostics.js +14 -0
  5. package/dist/Editor.d.ts +12 -0
  6. package/dist/Editor.js +95 -0
  7. package/dist/OpBar.d.ts +14 -0
  8. package/dist/OpBar.js +15 -0
  9. package/dist/Output.d.ts +20 -0
  10. package/dist/Output.js +56 -0
  11. package/dist/Tabs.d.ts +15 -0
  12. package/dist/Tabs.js +23 -0
  13. package/dist/cue-lang.d.ts +8 -0
  14. package/dist/cue-lang.js +82 -0
  15. package/dist/docs.d.ts +64 -0
  16. package/dist/docs.js +42 -0
  17. package/dist/index.d.ts +12 -0
  18. package/dist/index.js +18 -0
  19. package/dist/markers.d.ts +11 -0
  20. package/dist/markers.js +45 -0
  21. package/dist/ops.d.ts +13 -0
  22. package/dist/ops.js +22 -0
  23. package/dist/positions.d.ts +7 -0
  24. package/dist/positions.js +40 -0
  25. package/dist/theme.d.ts +16 -0
  26. package/dist/theme.js +55 -0
  27. package/dist/types.d.ts +580 -0
  28. package/dist/types.js +85 -0
  29. package/errors/E0101.md +43 -0
  30. package/errors/E0102.md +34 -0
  31. package/errors/E0103.md +41 -0
  32. package/errors/E0104.md +5 -0
  33. package/errors/E0105.md +62 -0
  34. package/errors/E0106.md +46 -0
  35. package/errors/E0107.md +48 -0
  36. package/errors/E0108.md +45 -0
  37. package/errors/E0109.md +37 -0
  38. package/errors/E0110.md +17 -0
  39. package/errors/E0111.md +55 -0
  40. package/errors/E0112.md +40 -0
  41. package/errors/E0120.md +34 -0
  42. package/errors/E0121.md +34 -0
  43. package/errors/E0122.md +26 -0
  44. package/errors/E0123.md +37 -0
  45. package/errors/E0124.md +36 -0
  46. package/errors/E0125.md +43 -0
  47. package/errors/E0126.md +38 -0
  48. package/errors/E0128.md +34 -0
  49. package/errors/E0129.md +42 -0
  50. package/errors/E0130.md +43 -0
  51. package/errors/E0131.md +42 -0
  52. package/errors/E0132.md +40 -0
  53. package/errors/E0133.md +46 -0
  54. package/errors/E0134.md +36 -0
  55. package/errors/E0135.md +109 -0
  56. package/errors/E0137.md +37 -0
  57. package/errors/E0140.md +46 -0
  58. package/errors/E0141.md +35 -0
  59. package/errors/E0142.md +38 -0
  60. package/errors/E0143.md +62 -0
  61. package/errors/E0144.md +49 -0
  62. package/errors/E0145.md +48 -0
  63. package/errors/E0146.md +38 -0
  64. package/errors/E0147.md +57 -0
  65. package/errors/E0148.md +42 -0
  66. package/errors/E0149.md +27 -0
  67. package/errors/E0150.md +77 -0
  68. package/errors/E0151.md +47 -0
  69. package/errors/E0152.md +35 -0
  70. package/errors/E0201.md +35 -0
  71. package/errors/E0202.md +42 -0
  72. package/errors/E0203.md +37 -0
  73. package/errors/E0204.md +46 -0
  74. package/errors/E0205.md +47 -0
  75. package/errors/E0206.md +47 -0
  76. package/errors/E0208.md +59 -0
  77. package/errors/E0210.md +44 -0
  78. package/errors/E0211.md +43 -0
  79. package/errors/E0212.md +41 -0
  80. package/errors/E0213.md +42 -0
  81. package/errors/E0214.md +42 -0
  82. package/errors/E0215.md +44 -0
  83. package/errors/E0216.md +41 -0
  84. package/errors/E0217.md +43 -0
  85. package/errors/E0218.md +44 -0
  86. package/errors/E0230.md +46 -0
  87. package/errors/E0232.md +42 -0
  88. package/errors/E0233.md +42 -0
  89. package/errors/E0234.md +43 -0
  90. package/errors/E0240.md +31 -0
  91. package/errors/E0242.md +5 -0
  92. package/errors/E0243.md +5 -0
  93. package/errors/E0250.md +39 -0
  94. package/errors/E0251.md +83 -0
  95. package/errors/E0252.md +42 -0
  96. package/errors/E0253.md +142 -0
  97. package/errors/E0254.md +38 -0
  98. package/errors/E0301.md +43 -0
  99. package/errors/E0302.md +58 -0
  100. package/errors/E0303.md +57 -0
  101. package/errors/E0304.md +9 -0
  102. package/errors/E0305.md +55 -0
  103. package/errors/E0307.md +9 -0
  104. package/errors/E0308.md +9 -0
  105. package/errors/E0310.md +46 -0
  106. package/errors/E0311.md +46 -0
  107. package/errors/E0330.md +67 -0
  108. package/errors/E0331.md +64 -0
  109. package/errors/E0332.md +52 -0
  110. package/errors/E0333.md +61 -0
  111. package/errors/E0334.md +61 -0
  112. package/errors/E0335.md +57 -0
  113. package/errors/E0336.md +50 -0
  114. package/errors/E0337.md +54 -0
  115. package/errors/E0338.md +62 -0
  116. package/errors/E0340.md +57 -0
  117. package/errors/E0341.md +51 -0
  118. package/errors/E0342.md +53 -0
  119. package/errors/E0343.md +56 -0
  120. package/errors/E0344.md +58 -0
  121. package/errors/E0345.md +51 -0
  122. package/errors/E0346.md +45 -0
  123. package/errors/E0347.md +53 -0
  124. package/errors/E0348.md +50 -0
  125. package/errors/E0349.md +52 -0
  126. package/errors/E0350.md +54 -0
  127. package/errors/E0351.md +54 -0
  128. package/errors/E0352.md +60 -0
  129. package/errors/E0353.md +53 -0
  130. package/errors/E0354.md +43 -0
  131. package/errors/E0355.md +55 -0
  132. package/errors/E0356.md +65 -0
  133. package/errors/E0357.md +68 -0
  134. package/errors/E0358.md +50 -0
  135. package/errors/E0359.md +53 -0
  136. package/errors/E0360.md +59 -0
  137. package/errors/E0361.md +59 -0
  138. package/errors/E0362.md +56 -0
  139. package/errors/E0364.md +58 -0
  140. package/errors/E0365.md +58 -0
  141. package/errors/E0366.md +56 -0
  142. package/errors/E0367.md +57 -0
  143. package/errors/E0368.md +58 -0
  144. package/errors/E0369.md +60 -0
  145. package/errors/E0370.md +59 -0
  146. package/errors/E0371.md +59 -0
  147. package/errors/E0372.md +57 -0
  148. package/errors/E0380.md +71 -0
  149. package/errors/E0381.md +61 -0
  150. package/errors/E0382.md +64 -0
  151. package/errors/E0383.md +61 -0
  152. package/errors/E0384.md +63 -0
  153. package/errors/E0385.md +61 -0
  154. package/errors/E0386.md +59 -0
  155. package/errors/E0387.md +59 -0
  156. package/errors/E0388.md +60 -0
  157. package/errors/E0389.md +59 -0
  158. package/errors/E0390.md +59 -0
  159. package/errors/E0401.md +56 -0
  160. package/errors/E0402.md +51 -0
  161. package/errors/E0403.md +51 -0
  162. package/errors/E0404.md +57 -0
  163. package/errors/E0405.md +56 -0
  164. package/errors/E0406.md +53 -0
  165. package/errors/E0407.md +54 -0
  166. package/errors/E0410.md +56 -0
  167. package/errors/E0411.md +59 -0
  168. package/errors/E0412.md +59 -0
  169. package/errors/E0413.md +74 -0
  170. package/errors/E0414.md +53 -0
  171. package/errors/E0415.md +72 -0
  172. package/errors/E0416.md +67 -0
  173. package/errors/E0418.md +59 -0
  174. package/errors/E0420.md +71 -0
  175. package/errors/E0421.md +82 -0
  176. package/errors/E0422.md +82 -0
  177. package/errors/E0423.md +83 -0
  178. package/errors/E0501.md +51 -0
  179. package/errors/E0502.md +50 -0
  180. package/errors/E0503.md +52 -0
  181. package/errors/E0504.md +64 -0
  182. package/errors/E0505.md +51 -0
  183. package/errors/E0506.md +48 -0
  184. package/errors/E0507.md +41 -0
  185. package/errors/E0508.md +39 -0
  186. package/errors/E0601.md +22 -0
  187. package/errors/E0602.md +28 -0
  188. package/errors/E0603.md +65 -0
  189. package/errors/E0604.md +37 -0
  190. package/errors/E0605.md +36 -0
  191. package/errors/E0606.md +44 -0
  192. package/errors/E0607.md +57 -0
  193. package/errors/E0608.md +37 -0
  194. package/errors/E0609.md +33 -0
  195. package/errors/E0611.md +37 -0
  196. package/errors/E0612.md +34 -0
  197. package/errors/E0613.md +30 -0
  198. package/errors/E0614.md +36 -0
  199. package/errors/E0616.md +33 -0
  200. package/errors/E0617.md +15 -0
  201. package/errors/E0618.md +16 -0
  202. package/errors/E0620.md +37 -0
  203. package/errors/E0621.md +45 -0
  204. package/errors/E0622.md +34 -0
  205. package/errors/E0623.md +33 -0
  206. package/errors/E0624.md +34 -0
  207. package/errors/E0625.md +28 -0
  208. package/errors/E0626.md +54 -0
  209. package/errors/E0627.md +27 -0
  210. package/errors/E0628.md +63 -0
  211. package/errors/E0701.md +25 -0
  212. package/errors/E0801.md +23 -0
  213. package/errors/E0802.md +22 -0
  214. package/errors/E0803.md +22 -0
  215. package/errors/E0804.md +25 -0
  216. package/errors/E0805.md +26 -0
  217. package/errors/E0901.md +27 -0
  218. package/errors/E0902.md +40 -0
  219. package/errors/E0903.md +23 -0
  220. package/errors/E1001.md +53 -0
  221. package/errors/E1002.md +43 -0
  222. package/errors/E1003.md +40 -0
  223. package/errors/E1004.md +44 -0
  224. package/errors/README.md +215 -0
  225. package/package.json +29 -3
@@ -0,0 +1,59 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0370: a lens's arithmetic may overflow
4
+
5
+ Integer arithmetic in a lens may exceed int64 for some instance. Bound the
6
+ fields the lens reads so that every result fits.
7
+
8
+ ## Example
9
+
10
+ `lineage.cue`:
11
+
12
+ ```cue
13
+ name: "ship"
14
+ schemas: {
15
+ "0": {
16
+ "0": {
17
+ schema: {
18
+ a: int64
19
+ b: int64
20
+ }
21
+ }
22
+ }
23
+ "1": {
24
+ "0": {
25
+ schema: {
26
+ n: int
27
+ }
28
+ }
29
+ }
30
+ }
31
+ lenses: {
32
+ "0.0->1.0": {
33
+ v0_0: _
34
+ v1_0: {
35
+ n: v0_0.a + v0_0.b
36
+ }
37
+ }
38
+ "1.0->0.0": {
39
+ v1_0: _
40
+ v0_0: {
41
+ a: 0
42
+ b: 0
43
+ }
44
+ }
45
+ }
46
+ ```
47
+
48
+ thema reports:
49
+
50
+ ```
51
+ error[E0370]: n in the result of lens 0.0->1.0 is not total for some instance
52
+ --> lineage.cue:23:7
53
+ |
54
+ 23 | n: v0_0.a + v0_0.b
55
+ | ^^^^
56
+ |
57
+ = note: n in the result of lens 0.0->1.0 computes v0_0.a + v0_0.b, whose result may be [-18446744073709551616, 18446744073709551614], outside int64; bound the fields it reads so that the result fits
58
+ = note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule arith-overflow)
59
+ ```
@@ -0,0 +1,59 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0371: a lens may divide by zero
4
+
5
+ A lens divides by a field that may be zero, which is an error in CUE, so the
6
+ lens fails on every instance where it is. Exclude zero from the divisor's
7
+ schema, or test for it.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ n: int32
20
+ d: int32
21
+ }
22
+ }
23
+ }
24
+ "1": {
25
+ "0": {
26
+ schema: {
27
+ q: int
28
+ }
29
+ }
30
+ }
31
+ }
32
+ lenses: {
33
+ "0.0->1.0": {
34
+ v0_0: _
35
+ v1_0: {
36
+ q: quo(v0_0.n, v0_0.d)
37
+ }
38
+ }
39
+ "1.0->0.0": {
40
+ v1_0: _
41
+ v0_0: {
42
+ n: 0
43
+ d: 1
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ thema reports:
50
+
51
+ ```
52
+ error[E0371]: q in the result of lens 0.0->1.0 divides by v0_0.d, which may be 0
53
+ --> lineage.cue:23:11
54
+ |
55
+ 23 | q: quo(v0_0.n, v0_0.d)
56
+ | ^^^^
57
+ |
58
+ = note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule division-by-zero)
59
+ ```
@@ -0,0 +1,57 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0372: a lens indexes a table with a value that has no entry
4
+
5
+ A lens looks a value up in a table, and some value the source allows has no
6
+ entry. Give the table an entry for every value, or a catch-all.
7
+
8
+ ## Example
9
+
10
+ `lineage.cue`:
11
+
12
+ ```cue
13
+ name: "ship"
14
+ schemas: {
15
+ "0": {
16
+ "0": {
17
+ schema: {
18
+ t: "a" | "b" | "c"
19
+ }
20
+ }
21
+ }
22
+ "1": {
23
+ "0": {
24
+ schema: {
25
+ u: 1 | 2
26
+ }
27
+ }
28
+ }
29
+ }
30
+ lenses: {
31
+ "0.0->1.0": {
32
+ _T: {a: 1, b: 2}
33
+ v0_0: _
34
+ v1_0: {
35
+ u: _T[v0_0.t]
36
+ }
37
+ }
38
+ "1.0->0.0": {
39
+ v1_0: _
40
+ v0_0: {
41
+ t: "a"
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ thema reports:
48
+
49
+ ```
50
+ error[E0372]: u in the result of lens 0.0->1.0 indexes a table by v0_0.t, which may be "c", for which the table has no entry
51
+ --> lineage.cue:23:7
52
+ |
53
+ 23 | u: _T[v0_0.t]
54
+ | ^^
55
+ |
56
+ = note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule table-key-missing)
57
+ ```
@@ -0,0 +1,71 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0380: a lens copies a value the checker cannot show its target accepts
4
+
5
+ The totality checker judges a copy with the compatibility checker: does the
6
+ target accept every value the source allows? Where the source constrains the
7
+ field by another field's value, the compatibility checker cannot decide, so
8
+ neither can the totality checker. A lens that cannot be shown total does not
9
+ bind.
10
+
11
+ ## Example
12
+
13
+ `lineage.cue`:
14
+
15
+ ```cue
16
+ name: "ship"
17
+ schemas: {
18
+ "0": {
19
+ "0": {
20
+ schema: {
21
+ a: int
22
+ b: <a
23
+ }
24
+ }
25
+ }
26
+ "1": {
27
+ "0": {
28
+ schema: {
29
+ b: int
30
+ }
31
+ }
32
+ }
33
+ }
34
+ lenses: {
35
+ "0.0->1.0": {
36
+ v0_0: _
37
+ v1_0: {
38
+ b: v0_0.b
39
+ }
40
+ }
41
+ "1.0->0.0": {
42
+ v1_0: _
43
+ v0_0: {
44
+ a: 1
45
+ b: 0
46
+ }
47
+ }
48
+ }
49
+ ```
50
+
51
+ thema reports:
52
+
53
+ ```
54
+ error[E0380]: b in the result of lens 0.0->1.0 is not total for some instance
55
+ --> lineage.cue:23:7
56
+ |
57
+ 23 | b: v0_0.b
58
+ | ^^^^
59
+ |
60
+ = note: b in the result of lens 0.0->1.0 copies v0_0.b, which is constrained by a in the source schema and not in the new one; the checker cannot compare constraints between fields (compat rule unknown-crossfield)
61
+ = note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule unknown-copy)
62
+ = help: write the mapping in a form the checker can follow, or add a lacuna where it cannot decide
63
+
64
+ error[E0366]: b in the result of lens 1.0->0.0 is the constant 0, which the target schema does not accept: non-concrete value a for bound <
65
+ --> lineage.cue:30:4
66
+ |
67
+ 30 | b: 0
68
+ | ^
69
+ |
70
+ = note: a lens must be total: every instance of schema 1.0 must translate to an instance of schema 0.0 (totality rule literal-not-instance)
71
+ ```
@@ -0,0 +1,61 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0381: a lens's condition is not one the checker can read
4
+
5
+ The checker reads a comprehension's condition as a pattern over the input: a
6
+ presence test, an equality, a type test, or a conjunction of these. A condition
7
+ of any other form, such as a comparison, is one it cannot reason about.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ n: int32
20
+ }
21
+ }
22
+ }
23
+ "1": {
24
+ "0": {
25
+ schema: {
26
+ big?: bool
27
+ }
28
+ }
29
+ }
30
+ }
31
+ lenses: {
32
+ "0.0->1.0": {
33
+ v0_0: _
34
+ v1_0: {
35
+ if v0_0.n > 5 {
36
+ big: true
37
+ }
38
+ }
39
+ }
40
+ "1.0->0.0": {
41
+ v1_0: _
42
+ v0_0: {
43
+ n: 0
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ thema reports:
50
+
51
+ ```
52
+ error[E0381]: the result of lens 0.0->1.0 is not total for some instance
53
+ --> lineage.cue:22:4
54
+ |
55
+ 22 | if v0_0.n > 5 {
56
+ | ^^
57
+ |
58
+ = note: the result of lens 0.0->1.0 has fields under v0_0.n > 5, which is not a pattern: a presence test (p != _|_), an equality (p == c) or a type test ((p & T) != _|_) on an input field, or a conjunction (&&) of these
59
+ = note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule unknown-pattern)
60
+ = help: write the mapping in a form the checker can follow, or add a lacuna where it cannot decide
61
+ ```
@@ -0,0 +1,64 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0382: a lens writes a required field only under conditions the checker cannot show exhaustive
4
+
5
+ A required target field written only under conditions must be written under
6
+ conditions that together cover every instance. Here two of the three values
7
+ `k` can take are handled, so the checker cannot show the third is.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ k: "x" | "y" | "z"
20
+ }
21
+ }
22
+ }
23
+ "1": {
24
+ "0": {
25
+ schema: {
26
+ a: string
27
+ }
28
+ }
29
+ }
30
+ }
31
+ lenses: {
32
+ "0.0->1.0": {
33
+ v0_0: _
34
+ v1_0: {
35
+ if v0_0.k == "x" {
36
+ a: "1"
37
+ }
38
+ if v0_0.k == "y" {
39
+ a: "2"
40
+ }
41
+ }
42
+ }
43
+ "1.0->0.0": {
44
+ v1_0: _
45
+ v0_0: {
46
+ k: "x"
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ thema reports:
53
+
54
+ ```
55
+ error[E0382]: a in the result of lens 0.0->1.0 is not total for some instance
56
+ --> lineage.cue:21:3
57
+ |
58
+ 21 | v1_0: {
59
+ | ^^^^
60
+ |
61
+ = note: a in the result of lens 0.0->1.0 is required by the target schema, and is written only under v0_0.k == "x"; v0_0.k == "y", which the checker cannot show cover every instance; write it unconditionally, under a condition and its negation, or under type tests covering every alternative of the tested field
62
+ = note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule unknown-exhaustive)
63
+ = help: write the mapping in a form the checker can follow, or add a lacuna where it cannot decide
64
+ ```
@@ -0,0 +1,61 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0383: a lens computes with an operation the checker cannot prove
4
+
5
+ The totality checker proves a fixed set of operations: arithmetic, len, and a
6
+ handful of string functions. A computation outside that set cannot be shown
7
+ to produce a value the target accepts.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ import "strconv"
15
+
16
+ name: "ship"
17
+ schemas: {
18
+ "0": {
19
+ "0": {
20
+ schema: {
21
+ s: string
22
+ }
23
+ }
24
+ }
25
+ "1": {
26
+ "0": {
27
+ schema: {
28
+ n: int
29
+ }
30
+ }
31
+ }
32
+ }
33
+ lenses: {
34
+ "0.0->1.0": {
35
+ v0_0: _
36
+ v1_0: {
37
+ n: strconv.Atoi(v0_0.s)
38
+ }
39
+ }
40
+ "1.0->0.0": {
41
+ v1_0: _
42
+ v0_0: {
43
+ s: "0"
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ thema reports:
50
+
51
+ ```
52
+ error[E0383]: n in the result of lens 0.0->1.0 is not total for some instance
53
+ --> lineage.cue:24:7
54
+ |
55
+ 24 | n: strconv.Atoi(v0_0.s)
56
+ | ^^^^^^^
57
+ |
58
+ = note: n in the result of lens 0.0->1.0 calls strconv.Atoi, which is outside the provable set (len; quo, rem, div, mod; strings.Contains, strings.HasPrefix, strings.HasSuffix, strings.Replace, strings.ToLower, strings.ToUpper, strings.Trim, strings.TrimLeft, strings.TrimPrefix, strings.TrimRight, strings.TrimSpace, strings.TrimSuffix)
59
+ = note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule unknown-op)
60
+ = help: write the mapping in a form the checker can follow, or add a lacuna where it cannot decide
61
+ ```
@@ -0,0 +1,63 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0384: a lens produces fields or elements dynamically
4
+
5
+ Fields or elements produced by a `for` clause, a dynamic label or a list
6
+ comprehension depend on the instance, so the checker cannot know which fields
7
+ the result has. Write each field.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ m: [string]: int
20
+ }
21
+ }
22
+ }
23
+ "1": {
24
+ "0": {
25
+ schema: {
26
+ mm: [string]: int
27
+ }
28
+ }
29
+ }
30
+ }
31
+ lenses: {
32
+ "0.0->1.0": {
33
+ v0_0: _
34
+ v1_0: {
35
+ mm: {
36
+ for k, v in v0_0.m {
37
+ "\(k)": v
38
+ }
39
+ }
40
+ }
41
+ }
42
+ "1.0->0.0": {
43
+ v1_0: _
44
+ v0_0: {
45
+ m: {}
46
+ }
47
+ }
48
+ }
49
+ ```
50
+
51
+ thema reports:
52
+
53
+ ```
54
+ error[E0384]: mm in the result of lens 0.0->1.0 is not total for some instance
55
+ --> lineage.cue:23:5
56
+ |
57
+ 23 | for k, v in v0_0.m {
58
+ | ^^^
59
+ |
60
+ = note: mm in the result of lens 0.0->1.0 has fields produced by a for clause over v0_0.m, so which fields exist depends on the instance; write each field
61
+ = note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule unknown-dynamic)
62
+ = help: write the mapping in a form the checker can follow, or add a lacuna where it cannot decide
63
+ ```
@@ -0,0 +1,61 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0385: a lens refers to something the checker cannot follow
4
+
5
+ The checker follows a lens's references to the input or to constants. A
6
+ selection by a computed index or label leads somewhere it cannot follow.
7
+ Select fields by name.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ k: string
20
+ m: [string]: int
21
+ }
22
+ }
23
+ }
24
+ "1": {
25
+ "0": {
26
+ schema: {
27
+ v: int
28
+ }
29
+ }
30
+ }
31
+ }
32
+ lenses: {
33
+ "0.0->1.0": {
34
+ v0_0: _
35
+ v1_0: {
36
+ v: v0_0.m[v0_0.k]
37
+ }
38
+ }
39
+ "1.0->0.0": {
40
+ v1_0: _
41
+ v0_0: {
42
+ k: ""
43
+ m: {}
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ thema reports:
50
+
51
+ ```
52
+ error[E0385]: v in the result of lens 0.0->1.0 is not total for some instance
53
+ --> lineage.cue:23:7
54
+ |
55
+ 23 | v: v0_0.m[v0_0.k]
56
+ | ^^^^
57
+ |
58
+ = note: v in the result of lens 0.0->1.0 reads v0_0.m[v0_0.k], a selection into the input the checker cannot follow (a computed index or label); select fields by name
59
+ = note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule unknown-reference)
60
+ = help: write the mapping in a form the checker can follow, or add a lacuna where it cannot decide
61
+ ```
@@ -0,0 +1,59 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0386: a lens's integer arithmetic has no bounds the checker can trust
4
+
5
+ To show integer arithmetic fits its target, the checker needs finite bounds on
6
+ what it reads. An unbounded int gives it none, so it cannot show the result
7
+ within int64 or within the target's bounds. Bound the fields the lens reads.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ n: int
20
+ }
21
+ }
22
+ }
23
+ "1": {
24
+ "0": {
25
+ schema: {
26
+ m: int32
27
+ }
28
+ }
29
+ }
30
+ }
31
+ lenses: {
32
+ "0.0->1.0": {
33
+ v0_0: _
34
+ v1_0: {
35
+ m: v0_0.n + 1
36
+ }
37
+ }
38
+ "1.0->0.0": {
39
+ v1_0: _
40
+ v0_0: {
41
+ n: v1_0.m
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ thema reports:
48
+
49
+ ```
50
+ error[E0386]: m in the result of lens 0.0->1.0 is not total for some instance
51
+ --> lineage.cue:22:7
52
+ |
53
+ 22 | m: v0_0.n + 1
54
+ | ^^^^
55
+ |
56
+ = note: m in the result of lens 0.0->1.0 is an integer computed by v0_0.n + 1, in [-inf, +inf], which the checker cannot show within int64 and the target's int32; bound the fields it reads (int32, >=0 & <=100)
57
+ = note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule unknown-bounds)
58
+ = help: write the mapping in a form the checker can follow, or add a lacuna where it cannot decide
59
+ ```
@@ -0,0 +1,59 @@
1
+ <!-- Generated by go test ./diag; do not edit. -->
2
+
3
+ # E0387: a lens's divisor may be zero as far as the checker can tell
4
+
5
+ A divisor's range includes zero, though zero itself may be excluded by a
6
+ constraint the checker does not follow. Bound the divisor away from zero with
7
+ `>0` or `<0`.
8
+
9
+ ## Example
10
+
11
+ `lineage.cue`:
12
+
13
+ ```cue
14
+ name: "ship"
15
+ schemas: {
16
+ "0": {
17
+ "0": {
18
+ schema: {
19
+ d: int & !=0 & >=-5 & <=5
20
+ }
21
+ }
22
+ }
23
+ "1": {
24
+ "0": {
25
+ schema: {
26
+ q: int
27
+ }
28
+ }
29
+ }
30
+ }
31
+ lenses: {
32
+ "0.0->1.0": {
33
+ v0_0: _
34
+ v1_0: {
35
+ q: quo(10, v0_0.d)
36
+ }
37
+ }
38
+ "1.0->0.0": {
39
+ v1_0: _
40
+ v0_0: {
41
+ d: 1
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ thema reports:
48
+
49
+ ```
50
+ error[E0387]: q in the result of lens 0.0->1.0 is not total for some instance
51
+ --> lineage.cue:22:11
52
+ |
53
+ 22 | q: quo(10, v0_0.d)
54
+ | ^^
55
+ |
56
+ = note: q in the result of lens 0.0->1.0 divides by v0_0.d, whose range [-5, 5] includes 0, though 0 may not be an instance; bound the divisor away from 0 (>0 or <0)
57
+ = note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule unknown-divisor)
58
+ = help: write the mapping in a form the checker can follow, or add a lacuna where it cannot decide
59
+ ```