@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.
- package/LICENSE +201 -0
- package/README.md +24 -1
- package/dist/Diagnostics.d.ts +8 -0
- package/dist/Diagnostics.js +14 -0
- package/dist/Editor.d.ts +12 -0
- package/dist/Editor.js +95 -0
- package/dist/OpBar.d.ts +14 -0
- package/dist/OpBar.js +15 -0
- package/dist/Output.d.ts +20 -0
- package/dist/Output.js +56 -0
- package/dist/Tabs.d.ts +15 -0
- package/dist/Tabs.js +23 -0
- package/dist/cue-lang.d.ts +8 -0
- package/dist/cue-lang.js +82 -0
- package/dist/docs.d.ts +64 -0
- package/dist/docs.js +42 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +18 -0
- package/dist/markers.d.ts +11 -0
- package/dist/markers.js +45 -0
- package/dist/ops.d.ts +13 -0
- package/dist/ops.js +22 -0
- package/dist/positions.d.ts +7 -0
- package/dist/positions.js +40 -0
- package/dist/theme.d.ts +16 -0
- package/dist/theme.js +55 -0
- package/dist/types.d.ts +580 -0
- package/dist/types.js +85 -0
- package/errors/E0101.md +43 -0
- package/errors/E0102.md +34 -0
- package/errors/E0103.md +41 -0
- package/errors/E0104.md +5 -0
- package/errors/E0105.md +62 -0
- package/errors/E0106.md +46 -0
- package/errors/E0107.md +48 -0
- package/errors/E0108.md +45 -0
- package/errors/E0109.md +37 -0
- package/errors/E0110.md +17 -0
- package/errors/E0111.md +55 -0
- package/errors/E0112.md +40 -0
- package/errors/E0120.md +34 -0
- package/errors/E0121.md +34 -0
- package/errors/E0122.md +26 -0
- package/errors/E0123.md +37 -0
- package/errors/E0124.md +36 -0
- package/errors/E0125.md +43 -0
- package/errors/E0126.md +38 -0
- package/errors/E0128.md +34 -0
- package/errors/E0129.md +42 -0
- package/errors/E0130.md +43 -0
- package/errors/E0131.md +42 -0
- package/errors/E0132.md +40 -0
- package/errors/E0133.md +46 -0
- package/errors/E0134.md +36 -0
- package/errors/E0135.md +109 -0
- package/errors/E0137.md +37 -0
- package/errors/E0140.md +46 -0
- package/errors/E0141.md +35 -0
- package/errors/E0142.md +38 -0
- package/errors/E0143.md +62 -0
- package/errors/E0144.md +49 -0
- package/errors/E0145.md +48 -0
- package/errors/E0146.md +38 -0
- package/errors/E0147.md +57 -0
- package/errors/E0148.md +42 -0
- package/errors/E0149.md +27 -0
- package/errors/E0150.md +77 -0
- package/errors/E0151.md +47 -0
- package/errors/E0152.md +35 -0
- package/errors/E0201.md +35 -0
- package/errors/E0202.md +42 -0
- package/errors/E0203.md +37 -0
- package/errors/E0204.md +46 -0
- package/errors/E0205.md +47 -0
- package/errors/E0206.md +47 -0
- package/errors/E0208.md +59 -0
- package/errors/E0210.md +44 -0
- package/errors/E0211.md +43 -0
- package/errors/E0212.md +41 -0
- package/errors/E0213.md +42 -0
- package/errors/E0214.md +42 -0
- package/errors/E0215.md +44 -0
- package/errors/E0216.md +41 -0
- package/errors/E0217.md +43 -0
- package/errors/E0218.md +44 -0
- package/errors/E0230.md +46 -0
- package/errors/E0232.md +42 -0
- package/errors/E0233.md +42 -0
- package/errors/E0234.md +43 -0
- package/errors/E0240.md +31 -0
- package/errors/E0242.md +5 -0
- package/errors/E0243.md +5 -0
- package/errors/E0250.md +39 -0
- package/errors/E0251.md +83 -0
- package/errors/E0252.md +42 -0
- package/errors/E0253.md +142 -0
- package/errors/E0254.md +38 -0
- package/errors/E0301.md +43 -0
- package/errors/E0302.md +58 -0
- package/errors/E0303.md +57 -0
- package/errors/E0304.md +9 -0
- package/errors/E0305.md +55 -0
- package/errors/E0307.md +9 -0
- package/errors/E0308.md +9 -0
- package/errors/E0310.md +46 -0
- package/errors/E0311.md +46 -0
- package/errors/E0330.md +67 -0
- package/errors/E0331.md +64 -0
- package/errors/E0332.md +52 -0
- package/errors/E0333.md +61 -0
- package/errors/E0334.md +61 -0
- package/errors/E0335.md +57 -0
- package/errors/E0336.md +50 -0
- package/errors/E0337.md +54 -0
- package/errors/E0338.md +62 -0
- package/errors/E0340.md +57 -0
- package/errors/E0341.md +51 -0
- package/errors/E0342.md +53 -0
- package/errors/E0343.md +56 -0
- package/errors/E0344.md +58 -0
- package/errors/E0345.md +51 -0
- package/errors/E0346.md +45 -0
- package/errors/E0347.md +53 -0
- package/errors/E0348.md +50 -0
- package/errors/E0349.md +52 -0
- package/errors/E0350.md +54 -0
- package/errors/E0351.md +54 -0
- package/errors/E0352.md +60 -0
- package/errors/E0353.md +53 -0
- package/errors/E0354.md +43 -0
- package/errors/E0355.md +55 -0
- package/errors/E0356.md +65 -0
- package/errors/E0357.md +68 -0
- package/errors/E0358.md +50 -0
- package/errors/E0359.md +53 -0
- package/errors/E0360.md +59 -0
- package/errors/E0361.md +59 -0
- package/errors/E0362.md +56 -0
- package/errors/E0364.md +58 -0
- package/errors/E0365.md +58 -0
- package/errors/E0366.md +56 -0
- package/errors/E0367.md +57 -0
- package/errors/E0368.md +58 -0
- package/errors/E0369.md +60 -0
- package/errors/E0370.md +59 -0
- package/errors/E0371.md +59 -0
- package/errors/E0372.md +57 -0
- package/errors/E0380.md +71 -0
- package/errors/E0381.md +61 -0
- package/errors/E0382.md +64 -0
- package/errors/E0383.md +61 -0
- package/errors/E0384.md +63 -0
- package/errors/E0385.md +61 -0
- package/errors/E0386.md +59 -0
- package/errors/E0387.md +59 -0
- package/errors/E0388.md +60 -0
- package/errors/E0389.md +59 -0
- package/errors/E0390.md +59 -0
- package/errors/E0401.md +56 -0
- package/errors/E0402.md +51 -0
- package/errors/E0403.md +51 -0
- package/errors/E0404.md +57 -0
- package/errors/E0405.md +56 -0
- package/errors/E0406.md +53 -0
- package/errors/E0407.md +54 -0
- package/errors/E0410.md +56 -0
- package/errors/E0411.md +59 -0
- package/errors/E0412.md +59 -0
- package/errors/E0413.md +74 -0
- package/errors/E0414.md +53 -0
- package/errors/E0415.md +72 -0
- package/errors/E0416.md +67 -0
- package/errors/E0418.md +59 -0
- package/errors/E0420.md +71 -0
- package/errors/E0421.md +82 -0
- package/errors/E0422.md +82 -0
- package/errors/E0423.md +83 -0
- package/errors/E0501.md +51 -0
- package/errors/E0502.md +50 -0
- package/errors/E0503.md +52 -0
- package/errors/E0504.md +64 -0
- package/errors/E0505.md +51 -0
- package/errors/E0506.md +48 -0
- package/errors/E0507.md +41 -0
- package/errors/E0508.md +39 -0
- package/errors/E0601.md +22 -0
- package/errors/E0602.md +28 -0
- package/errors/E0603.md +65 -0
- package/errors/E0604.md +37 -0
- package/errors/E0605.md +36 -0
- package/errors/E0606.md +44 -0
- package/errors/E0607.md +57 -0
- package/errors/E0608.md +37 -0
- package/errors/E0609.md +33 -0
- package/errors/E0611.md +37 -0
- package/errors/E0612.md +34 -0
- package/errors/E0613.md +30 -0
- package/errors/E0614.md +36 -0
- package/errors/E0616.md +33 -0
- package/errors/E0617.md +15 -0
- package/errors/E0618.md +16 -0
- package/errors/E0620.md +37 -0
- package/errors/E0621.md +45 -0
- package/errors/E0622.md +34 -0
- package/errors/E0623.md +33 -0
- package/errors/E0624.md +34 -0
- package/errors/E0625.md +28 -0
- package/errors/E0626.md +54 -0
- package/errors/E0627.md +27 -0
- package/errors/E0628.md +63 -0
- package/errors/E0701.md +25 -0
- package/errors/E0801.md +23 -0
- package/errors/E0802.md +22 -0
- package/errors/E0803.md +22 -0
- package/errors/E0804.md +25 -0
- package/errors/E0805.md +26 -0
- package/errors/E0901.md +27 -0
- package/errors/E0902.md +40 -0
- package/errors/E0903.md +23 -0
- package/errors/E1001.md +53 -0
- package/errors/E1002.md +43 -0
- package/errors/E1003.md +40 -0
- package/errors/E1004.md +44 -0
- package/errors/README.md +215 -0
- package/package.json +29 -3
package/errors/E0357.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0357: a mapping calls a function a lens may not call
|
|
4
|
+
|
|
5
|
+
A mapping calls a function the lens language does not have. A computed
|
|
6
|
+
mapping may use CUE's arithmetic, comparisons and the strings functions the
|
|
7
|
+
help lists; anything else would make a lens whose totality thema cannot
|
|
8
|
+
check.
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
`ship/history/0.0.thema`:
|
|
13
|
+
|
|
14
|
+
```cue
|
|
15
|
+
Schema: {
|
|
16
|
+
name: string
|
|
17
|
+
count?: int
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`ship/history/1.0.thema`:
|
|
22
|
+
|
|
23
|
+
```cue
|
|
24
|
+
Schema: {
|
|
25
|
+
name: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
ForwardLens: {
|
|
29
|
+
v0_0: _
|
|
30
|
+
v1_0: {
|
|
31
|
+
name: strings.Reverse(v0_0.name)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
BackwardLens: {
|
|
36
|
+
v1_0: _
|
|
37
|
+
v0_0: {
|
|
38
|
+
name: v1_0.name
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`ship/tip.thema`:
|
|
44
|
+
|
|
45
|
+
```cue
|
|
46
|
+
Schema: {
|
|
47
|
+
name: string
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
thema reports:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
error[E0357]: strings.Reverse is not a function a lens may call
|
|
55
|
+
--> history/1.0.thema:8:9
|
|
56
|
+
|
|
|
57
|
+
8 | name: strings.Reverse(v0_0.name)
|
|
58
|
+
| ^^^^^^^
|
|
59
|
+
|
|
|
60
|
+
= help: the strings functions a lens may call are strings.Contains, strings.HasPrefix, strings.HasSuffix, strings.Replace, strings.ToLower, strings.ToUpper, strings.Trim, strings.TrimLeft, strings.TrimPrefix, strings.TrimRight, strings.TrimSpace, strings.TrimSuffix
|
|
61
|
+
|
|
62
|
+
error[E0347]: 0.0 declares count and 1.0 does not, and nothing maps it: write <field>: v0_0.count to move it, or count: _drop
|
|
63
|
+
--> history/1.0.thema:5:1
|
|
64
|
+
|
|
|
65
|
+
5 | ForwardLens: {
|
|
66
|
+
| ^^^^^^^^^^^
|
|
67
|
+
|
|
|
68
|
+
```
|
package/errors/E0358.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0358: a field both versions declare cannot be copied: the target does not accept every source value
|
|
4
|
+
|
|
5
|
+
A field both versions declare, and no lens mentions, is copied. The copy has
|
|
6
|
+
to produce a value the target accepts. Here kind narrows from any string to
|
|
7
|
+
two of them, and the ForwardLens does not map it.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
name: string
|
|
16
|
+
kind: string
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`ship/history/1.0.thema`:
|
|
21
|
+
|
|
22
|
+
```cue
|
|
23
|
+
Schema: {
|
|
24
|
+
name: string
|
|
25
|
+
kind: "a" | "b"
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`ship/tip.thema`:
|
|
30
|
+
|
|
31
|
+
```cue
|
|
32
|
+
Schema: {
|
|
33
|
+
name: string
|
|
34
|
+
kind: "a" | "b"
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
thema reports:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
error[E0358]: the ForwardLens in history/1.0.thema would copy v0_0.kind into kind, which does not accept every value of it
|
|
42
|
+
--> history/1.0.thema:1:1
|
|
43
|
+
|
|
|
44
|
+
1 | Schema: {
|
|
45
|
+
| ^^^^^^
|
|
46
|
+
|
|
|
47
|
+
= note: both 0.0 and 1.0 declare kind, so a lens that does not map it copies it
|
|
48
|
+
= note: kind in 1.0 is now "a" | "b", which does not accept every value of the prior string (copying v0_0.kind; compatibility rule value-narrowed)
|
|
49
|
+
= help: map kind in the ForwardLens: a _match, a computed value, or a constant
|
|
50
|
+
```
|
package/errors/E0359.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0359: a move reads a source field whose values the target field does not all accept
|
|
4
|
+
|
|
5
|
+
A move takes a source field's value as it is, so the target field must
|
|
6
|
+
accept every value the source field may hold. Here count may be any integer,
|
|
7
|
+
and total accepts only non-negative ones.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
count: int
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`ship/history/1.0.thema`:
|
|
20
|
+
|
|
21
|
+
```cue
|
|
22
|
+
Schema: {
|
|
23
|
+
total: int & >=0
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ForwardLens: {
|
|
27
|
+
v0_0: _
|
|
28
|
+
v1_0: {
|
|
29
|
+
total: v0_0.count
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`ship/tip.thema`:
|
|
35
|
+
|
|
36
|
+
```cue
|
|
37
|
+
Schema: {
|
|
38
|
+
total: int & >=0
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
thema reports:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
error[E0359]: the ForwardLens in history/1.0.thema moves v0_0.count into total, which does not accept every value of it
|
|
46
|
+
--> history/1.0.thema:8:10
|
|
47
|
+
|
|
|
48
|
+
8 | total: v0_0.count
|
|
49
|
+
| ^^^^
|
|
50
|
+
|
|
|
51
|
+
= note: total in 1.0 is now uint, which does not accept every value of the prior int (moving v0_0.count; compatibility rule value-narrowed)
|
|
52
|
+
= help: map total from a value it accepts: a _match, or a computed value
|
|
53
|
+
```
|
package/errors/E0360.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0360: a lens copies a value its target rejects for some instance
|
|
4
|
+
|
|
5
|
+
A lens is total: every instance of its source schema translates to an instance
|
|
6
|
+
of its target. Copying a field whose target is narrower than its source fails
|
|
7
|
+
for the instances the target rejects. Here 0.0 allows any int and 1.0 only
|
|
8
|
+
those below 10, so copying `a` forward is not total.
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
`lineage.cue`:
|
|
13
|
+
|
|
14
|
+
```cue
|
|
15
|
+
name: "ship"
|
|
16
|
+
schemas: {
|
|
17
|
+
"0": {
|
|
18
|
+
"0": {
|
|
19
|
+
schema: {
|
|
20
|
+
a!: int
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
"1": {
|
|
25
|
+
"0": {
|
|
26
|
+
schema: {
|
|
27
|
+
a!: int & <10
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
lenses: {
|
|
33
|
+
"0.0->1.0": {
|
|
34
|
+
v0_0: _
|
|
35
|
+
v1_0: {
|
|
36
|
+
a: v0_0.a
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
"1.0->0.0": {
|
|
40
|
+
v1_0: _
|
|
41
|
+
v0_0: {
|
|
42
|
+
a: v1_0.a
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
thema reports:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
error[E0360]: a in the result of lens 0.0->1.0 is not total for some instance
|
|
52
|
+
--> lineage.cue:22:7
|
|
53
|
+
|
|
|
54
|
+
22 | a: v0_0.a
|
|
55
|
+
| ^^^^
|
|
56
|
+
|
|
|
57
|
+
= note: a in the result of lens 0.0->1.0 copies v0_0.a, which is now int & <10, which does not accept every value of the prior int (compat rule value-narrowed)
|
|
58
|
+
= note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule copy-narrowed)
|
|
59
|
+
```
|
package/errors/E0361.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0361: a lens reads a field that may be absent
|
|
4
|
+
|
|
5
|
+
A lens reads a field that may be absent from the input: an optional field, with
|
|
6
|
+
no test that it is present. For the instances that lack it, the lens produces
|
|
7
|
+
nothing there. Write the field under a presence test, or give it a fallback.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`lineage.cue`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
name: "ship"
|
|
15
|
+
schemas: {
|
|
16
|
+
"0": {
|
|
17
|
+
"0": {
|
|
18
|
+
schema: {
|
|
19
|
+
b: string
|
|
20
|
+
c?: string
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
"1": {
|
|
25
|
+
"0": {
|
|
26
|
+
schema: {
|
|
27
|
+
a: string
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
lenses: {
|
|
33
|
+
"0.0->1.0": {
|
|
34
|
+
v0_0: _
|
|
35
|
+
v1_0: {
|
|
36
|
+
a: v0_0.c
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
"1.0->0.0": {
|
|
40
|
+
v1_0: _
|
|
41
|
+
v0_0: {
|
|
42
|
+
b: v1_0.a
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
thema reports:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
error[E0361]: a in the result of lens 0.0->1.0 is not total for some instance
|
|
52
|
+
--> lineage.cue:23:7
|
|
53
|
+
|
|
|
54
|
+
23 | a: v0_0.c
|
|
55
|
+
| ^^^^
|
|
56
|
+
|
|
|
57
|
+
= note: a in the result of lens 0.0->1.0 copies v0_0.c, which may be absent: v0_0.c is optional in the source schema; write the field under if v0_0.c != _|_
|
|
58
|
+
= note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule source-absent)
|
|
59
|
+
```
|
package/errors/E0362.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0362: a lens reads a field its source schema does not declare
|
|
4
|
+
|
|
5
|
+
A lens reads a field its source schema does not declare. No instance of the
|
|
6
|
+
source has it, so the lens never has a value to copy.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`lineage.cue`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
name: "ship"
|
|
14
|
+
schemas: {
|
|
15
|
+
"0": {
|
|
16
|
+
"0": {
|
|
17
|
+
schema: {
|
|
18
|
+
a: string
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
"1": {
|
|
23
|
+
"0": {
|
|
24
|
+
schema: {
|
|
25
|
+
b: string
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
lenses: {
|
|
31
|
+
"0.0->1.0": {
|
|
32
|
+
v0_0: _
|
|
33
|
+
v1_0: {
|
|
34
|
+
b: v0_0.nope
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
"1.0->0.0": {
|
|
38
|
+
v1_0: _
|
|
39
|
+
v0_0: {
|
|
40
|
+
a: v1_0.b
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
thema reports:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
error[E0362]: b in the result of lens 0.0->1.0 copies v0_0.nope, which the source schema does not declare
|
|
50
|
+
--> lineage.cue:22:7
|
|
51
|
+
|
|
|
52
|
+
22 | b: v0_0.nope
|
|
53
|
+
| ^^^^
|
|
54
|
+
|
|
|
55
|
+
= note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule source-undeclared)
|
|
56
|
+
```
|
package/errors/E0364.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0364: a lens's pattern tests a field that may be absent
|
|
4
|
+
|
|
5
|
+
A pattern that compares a field tests a field that may be absent. In CUE,
|
|
6
|
+
comparing an absent field is an error rather than false, so the lens fails on
|
|
7
|
+
every instance that lacks the field. Test presence first.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`lineage.cue`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
name: "ship"
|
|
15
|
+
schemas: {
|
|
16
|
+
"0": {
|
|
17
|
+
"0": {
|
|
18
|
+
schema: {
|
|
19
|
+
c?: string
|
|
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
|
+
if v0_0.c == "x" {
|
|
36
|
+
q: 1
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
"1.0->0.0": {
|
|
41
|
+
v1_0: _
|
|
42
|
+
v0_0: {}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
thema reports:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
error[E0364]: the result of lens 0.0->1.0 is not total for some instance
|
|
51
|
+
--> lineage.cue:22:4
|
|
52
|
+
|
|
|
53
|
+
22 | if v0_0.c == "x" {
|
|
54
|
+
| ^^
|
|
55
|
+
|
|
|
56
|
+
= note: the result of lens 0.0->1.0 is under the pattern v0_0.c == "x", but v0_0.c may be absent (v0_0.c is optional in the source schema), and comparing an absent field is an error rather than false; test presence first: if v0_0.c != _|_
|
|
57
|
+
= note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule pattern-absent)
|
|
58
|
+
```
|
package/errors/E0365.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0365: a lens writes a constraint where an instance needs a value
|
|
4
|
+
|
|
5
|
+
A lens writes a constraint, such as `int` or a disjunction, where an instance
|
|
6
|
+
needs one concrete value. The result would not be an instance of the target.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`lineage.cue`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
name: "ship"
|
|
14
|
+
schemas: {
|
|
15
|
+
"0": {
|
|
16
|
+
"0": {
|
|
17
|
+
schema: {
|
|
18
|
+
a: string
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
"1": {
|
|
23
|
+
"0": {
|
|
24
|
+
schema: {
|
|
25
|
+
a: string
|
|
26
|
+
n: int
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
lenses: {
|
|
32
|
+
"0.0->1.0": {
|
|
33
|
+
v0_0: _
|
|
34
|
+
v1_0: {
|
|
35
|
+
a: v0_0.a
|
|
36
|
+
n: int
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
"1.0->0.0": {
|
|
40
|
+
v1_0: _
|
|
41
|
+
v0_0: {
|
|
42
|
+
a: v1_0.a
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
thema reports:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
error[E0365]: n in the result of lens 0.0->1.0 is int, a constraint rather than a value; a result field must have a concrete value
|
|
52
|
+
--> lineage.cue:24:4
|
|
53
|
+
|
|
|
54
|
+
24 | n: int
|
|
55
|
+
| ^
|
|
56
|
+
|
|
|
57
|
+
= note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule not-a-value)
|
|
58
|
+
```
|
package/errors/E0366.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0366: a lens writes a literal its target rejects
|
|
4
|
+
|
|
5
|
+
A literal the lens writes is not an instance of the target at that path. Here
|
|
6
|
+
the target wants a list of one int and the lens writes two elements.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`lineage.cue`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
name: "ship"
|
|
14
|
+
schemas: {
|
|
15
|
+
"0": {
|
|
16
|
+
"0": {
|
|
17
|
+
schema: {
|
|
18
|
+
a: int
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
"1": {
|
|
23
|
+
"0": {
|
|
24
|
+
schema: {
|
|
25
|
+
l: [int]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
lenses: {
|
|
31
|
+
"0.0->1.0": {
|
|
32
|
+
v0_0: _
|
|
33
|
+
v1_0: {
|
|
34
|
+
l: [v0_0.a, 1]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
"1.0->0.0": {
|
|
38
|
+
v1_0: _
|
|
39
|
+
v0_0: {
|
|
40
|
+
a: v1_0.l[0]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
thema reports:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
error[E0366]: l in the result of lens 0.0->1.0 is a list of 2 elements, which the target schema does not accept: incompatible list lengths (1 and 2)
|
|
50
|
+
--> lineage.cue:22:4
|
|
51
|
+
|
|
|
52
|
+
22 | l: [v0_0.a, 1]
|
|
53
|
+
| ^
|
|
54
|
+
|
|
|
55
|
+
= note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule literal-not-instance)
|
|
56
|
+
```
|
package/errors/E0367.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0367: a lens computes a value its target rejects for some instance
|
|
4
|
+
|
|
5
|
+
A computed value has a possible result the target rejects. Here the lens
|
|
6
|
+
subtracts one from a non-negative int and writes it where the target requires
|
|
7
|
+
a non-negative int: for an input of 0 the result is -1.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`lineage.cue`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
name: "ship"
|
|
15
|
+
schemas: {
|
|
16
|
+
"0": {
|
|
17
|
+
"0": {
|
|
18
|
+
schema: {
|
|
19
|
+
a: int & >=0
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
"1": {
|
|
24
|
+
"0": {
|
|
25
|
+
schema: {
|
|
26
|
+
n: int & >=0
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
lenses: {
|
|
32
|
+
"0.0->1.0": {
|
|
33
|
+
v0_0: _
|
|
34
|
+
v1_0: {
|
|
35
|
+
n: v0_0.a - 1
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
"1.0->0.0": {
|
|
39
|
+
v1_0: _
|
|
40
|
+
v0_0: {
|
|
41
|
+
a: v1_0.n
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
thema reports:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
error[E0367]: n in the result of lens 0.0->1.0 is v0_0.a - 1, which may be as low as -1, where the target schema requires >=0
|
|
51
|
+
--> lineage.cue:22:7
|
|
52
|
+
|
|
|
53
|
+
22 | n: v0_0.a - 1
|
|
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 computed-narrowed)
|
|
57
|
+
```
|
package/errors/E0368.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0368: a lens leaves a required field unwritten for some instance
|
|
4
|
+
|
|
5
|
+
The target schema requires a field the lens never writes, so no result is an
|
|
6
|
+
instance of the target. Write the field: from the input, as a constant, or
|
|
7
|
+
through a mapping.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`lineage.cue`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
name: "ship"
|
|
15
|
+
schemas: {
|
|
16
|
+
"0": {
|
|
17
|
+
"0": {
|
|
18
|
+
schema: {
|
|
19
|
+
a: string
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
"1": {
|
|
24
|
+
"0": {
|
|
25
|
+
schema: {
|
|
26
|
+
a: string
|
|
27
|
+
b: int
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
lenses: {
|
|
33
|
+
"0.0->1.0": {
|
|
34
|
+
v0_0: _
|
|
35
|
+
v1_0: {
|
|
36
|
+
a: v0_0.a
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
"1.0->0.0": {
|
|
40
|
+
v1_0: _
|
|
41
|
+
v0_0: {
|
|
42
|
+
a: v1_0.a
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
thema reports:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
error[E0368]: b in the result of lens 0.0->1.0 is required by the target schema and never written
|
|
52
|
+
--> lineage.cue:22:3
|
|
53
|
+
|
|
|
54
|
+
22 | v1_0: {
|
|
55
|
+
| ^^^^
|
|
56
|
+
|
|
|
57
|
+
= note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule required-not-written)
|
|
58
|
+
```
|
package/errors/E0369.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0369: a lens writes a field twice with values that may disagree
|
|
4
|
+
|
|
5
|
+
A field written twice unifies the two values. Where they can disagree, one
|
|
6
|
+
rejects the other's value and the lens fails. Write each field once.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`lineage.cue`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
name: "ship"
|
|
14
|
+
schemas: {
|
|
15
|
+
"0": {
|
|
16
|
+
"0": {
|
|
17
|
+
schema: {
|
|
18
|
+
a: int
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
"1": {
|
|
23
|
+
"0": {
|
|
24
|
+
schema: {
|
|
25
|
+
a: int
|
|
26
|
+
k: string
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
lenses: {
|
|
32
|
+
"0.0->1.0": {
|
|
33
|
+
v0_0: _
|
|
34
|
+
v1_0: {
|
|
35
|
+
a: v0_0.a
|
|
36
|
+
a: 1000
|
|
37
|
+
k: "v"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
"1.0->0.0": {
|
|
41
|
+
v1_0: _
|
|
42
|
+
v0_0: {
|
|
43
|
+
a: v1_0.a
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
thema reports:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
error[E0369]: a in the result of lens 0.0->1.0 is not total for some instance
|
|
53
|
+
--> lineage.cue:23:4
|
|
54
|
+
|
|
|
55
|
+
23 | a: v0_0.a
|
|
56
|
+
| ^
|
|
57
|
+
|
|
|
58
|
+
= note: a in the result of lens 0.0->1.0 is written as v0_0.a and as 1000, and the two unify, so one may reject the other's value; write the field once
|
|
59
|
+
= note: a lens must be total: every instance of schema 0.0 must translate to an instance of schema 1.0 (totality rule write-conflict)
|
|
60
|
+
```
|