@sdboyer/thema-ui 0.0.0-stage → 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 +25 -2
- 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 +34 -4
package/errors/E0344.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0344: a constant in a lens is not an instance of its target field
|
|
4
|
+
|
|
5
|
+
A constant written in a lens is an instance of the target field it fills. Here
|
|
6
|
+
a string is written where the target declares an int; CUE's account of the
|
|
7
|
+
conflict is in the detail.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
a: string
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`ship/history/1.0.thema`:
|
|
20
|
+
|
|
21
|
+
```cue
|
|
22
|
+
Schema: {
|
|
23
|
+
a: string
|
|
24
|
+
b: int
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ForwardLens: {
|
|
28
|
+
v0_0: _
|
|
29
|
+
v1_0: {
|
|
30
|
+
b: "one"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`ship/tip.thema`:
|
|
36
|
+
|
|
37
|
+
```cue
|
|
38
|
+
Schema: {
|
|
39
|
+
a: string
|
|
40
|
+
b: int
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
thema reports:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
error[E0344]: "one" is not an instance of 1.0's b
|
|
48
|
+
--> history/1.0.thema:9:6
|
|
49
|
+
|
|
|
50
|
+
3 | b: int
|
|
51
|
+
| --- here
|
|
52
|
+
...
|
|
53
|
+
9 | b: "one"
|
|
54
|
+
| ^^^^^
|
|
55
|
+
| ----- also here
|
|
56
|
+
|
|
|
57
|
+
= detail: schema.b: conflicting values int and "one" (mismatched types int and string)
|
|
58
|
+
```
|
package/errors/E0345.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0345: a lens maps a target field twice
|
|
4
|
+
|
|
5
|
+
Each target field is mapped once. Two mappings for one field would have to
|
|
6
|
+
agree on every instance, and the lens language has no way to say which wins.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
a: string
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`ship/history/1.0.thema`:
|
|
19
|
+
|
|
20
|
+
```cue
|
|
21
|
+
Schema: {
|
|
22
|
+
b: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ForwardLens: {
|
|
26
|
+
v0_0: _
|
|
27
|
+
v1_0: {
|
|
28
|
+
b: v0_0.a
|
|
29
|
+
b: "x"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`ship/tip.thema`:
|
|
35
|
+
|
|
36
|
+
```cue
|
|
37
|
+
Schema: {
|
|
38
|
+
b: string
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
thema reports:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
error[E0345]: b is mapped twice
|
|
46
|
+
--> history/1.0.thema:9:3
|
|
47
|
+
|
|
|
48
|
+
9 | b: "x"
|
|
49
|
+
| ^
|
|
50
|
+
|
|
|
51
|
+
```
|
package/errors/E0346.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0346: a lens produces nothing for a field its target version requires
|
|
4
|
+
|
|
5
|
+
A lens produces every field its target requires. Here the new version adds a
|
|
6
|
+
required field the source lacks, and no lens says where it comes from.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
a: string
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`ship/history/1.0.thema`:
|
|
19
|
+
|
|
20
|
+
```cue
|
|
21
|
+
Schema: {
|
|
22
|
+
a: string
|
|
23
|
+
b: int
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`ship/tip.thema`:
|
|
28
|
+
|
|
29
|
+
```cue
|
|
30
|
+
Schema: {
|
|
31
|
+
a: string
|
|
32
|
+
b: int
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
thema reports:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
error[E0346]: history/1.0.thema has no ForwardLens, and 1.0 requires b: write ForwardLens: {v0_0: _, v1_0: {b: <mapping>}}
|
|
40
|
+
--> history/1.0.thema:1:1
|
|
41
|
+
|
|
|
42
|
+
1 | Schema: {
|
|
43
|
+
| ^^^^^^
|
|
44
|
+
|
|
|
45
|
+
```
|
package/errors/E0347.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0347: a field the source version has and the target lacks is neither mapped nor dropped
|
|
4
|
+
|
|
5
|
+
A field the source version has and the target lacks is either mapped somewhere
|
|
6
|
+
or dropped, explicitly. A forgotten rename would otherwise be silent data loss.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
before: string
|
|
15
|
+
unchanged: string
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`ship/history/1.0.thema`:
|
|
20
|
+
|
|
21
|
+
```cue
|
|
22
|
+
Schema: {
|
|
23
|
+
after: string
|
|
24
|
+
unchanged: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ForwardLens: {
|
|
28
|
+
v0_0: _
|
|
29
|
+
v1_0: {
|
|
30
|
+
after: "x"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`ship/tip.thema`:
|
|
36
|
+
|
|
37
|
+
```cue
|
|
38
|
+
Schema: {
|
|
39
|
+
after: string
|
|
40
|
+
unchanged: string
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
thema reports:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
error[E0347]: 0.0 declares before and 1.0 does not, and nothing maps it: write <field>: v0_0.before to move it, or before: _drop
|
|
48
|
+
--> history/1.0.thema:6:1
|
|
49
|
+
|
|
|
50
|
+
6 | ForwardLens: {
|
|
51
|
+
| ^^^^^^^^^^^
|
|
52
|
+
|
|
|
53
|
+
```
|
package/errors/E0348.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0348: a _coalesce reads a field the source version always has
|
|
4
|
+
|
|
5
|
+
coalesce supplies a fallback for a field that may be absent. Over a field the
|
|
6
|
+
source always has, the fallback could never apply; write the reference alone.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
a: string
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`ship/history/1.0.thema`:
|
|
19
|
+
|
|
20
|
+
```cue
|
|
21
|
+
Schema: {
|
|
22
|
+
b: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ForwardLens: {
|
|
26
|
+
v0_0: _
|
|
27
|
+
v1_0: {
|
|
28
|
+
b: _coalesce(v0_0.a, "x")
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`ship/tip.thema`:
|
|
34
|
+
|
|
35
|
+
```cue
|
|
36
|
+
Schema: {
|
|
37
|
+
b: string
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
thema reports:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
error[E0348]: 0.0 always has a, so _coalesce's fallback could never apply: write b: v0_0.a
|
|
45
|
+
--> history/1.0.thema:8:6
|
|
46
|
+
|
|
|
47
|
+
8 | b: _coalesce(v0_0.a, "x")
|
|
48
|
+
| ^^^^^^^^^
|
|
49
|
+
|
|
|
50
|
+
```
|
package/errors/E0349.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0349: a _coalesce's fallback may itself be absent
|
|
4
|
+
|
|
5
|
+
coalesce's fallback is what the lens uses when the field is absent, so the
|
|
6
|
+
fallback itself must always exist: a constant, or a field the source always
|
|
7
|
+
has. An optional field may be absent too.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
a?: string
|
|
16
|
+
b?: string
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`ship/history/1.0.thema`:
|
|
21
|
+
|
|
22
|
+
```cue
|
|
23
|
+
Schema: {
|
|
24
|
+
c: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ForwardLens: {
|
|
28
|
+
v0_0: _
|
|
29
|
+
v1_0: {
|
|
30
|
+
c: _coalesce(v0_0.a, v0_0.b)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`ship/tip.thema`:
|
|
36
|
+
|
|
37
|
+
```cue
|
|
38
|
+
Schema: {
|
|
39
|
+
c: string
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
thema reports:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
error[E0349]: b is optional in 0.0, so it cannot be _coalesce's fallback: the fallback must always exist
|
|
47
|
+
--> history/1.0.thema:8:24
|
|
48
|
+
|
|
|
49
|
+
8 | c: _coalesce(v0_0.a, v0_0.b)
|
|
50
|
+
| ^^^^
|
|
51
|
+
|
|
|
52
|
+
```
|
package/errors/E0350.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0350: a _match has two arms for one value
|
|
4
|
+
|
|
5
|
+
Each arm of a match matches one source value; two arms for the same value
|
|
6
|
+
would have to agree. Write each value once.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
kind: "a" | "b"
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`ship/history/1.0.thema`:
|
|
19
|
+
|
|
20
|
+
```cue
|
|
21
|
+
Schema: {
|
|
22
|
+
kind: 1 | 2
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ForwardLens: {
|
|
26
|
+
v0_0: _
|
|
27
|
+
v1_0: {
|
|
28
|
+
kind: _match(v0_0.kind, {
|
|
29
|
+
"a": 1
|
|
30
|
+
"a": 2
|
|
31
|
+
"b": 2
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`ship/tip.thema`:
|
|
38
|
+
|
|
39
|
+
```cue
|
|
40
|
+
Schema: {
|
|
41
|
+
kind: 1 | 2
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
thema reports:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
error[E0350]: _match has two arms for "a"
|
|
49
|
+
--> history/1.0.thema:10:4
|
|
50
|
+
|
|
|
51
|
+
10 | "a": 2
|
|
52
|
+
| ^^^
|
|
53
|
+
|
|
|
54
|
+
```
|
package/errors/E0351.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0351: a _match is not exhaustive
|
|
4
|
+
|
|
5
|
+
A match is exhaustive: every value the source field can hold is matched by
|
|
6
|
+
an arm, or accepted by the target as it is, or caught by a `[_]` arm. Here one
|
|
7
|
+
value of an enum is none of these.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
kind: "a" | "b" | "c"
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`ship/history/1.0.thema`:
|
|
20
|
+
|
|
21
|
+
```cue
|
|
22
|
+
Schema: {
|
|
23
|
+
kind: "a" | "b"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ForwardLens: {
|
|
27
|
+
v0_0: _
|
|
28
|
+
v1_0: {
|
|
29
|
+
kind: _match(v0_0.kind, {
|
|
30
|
+
"a": "b"
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`ship/tip.thema`:
|
|
37
|
+
|
|
38
|
+
```cue
|
|
39
|
+
Schema: {
|
|
40
|
+
kind: "a" | "b"
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
thema reports:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
error[E0351]: _match on kind is not exhaustive: 0.0's kind may be "c", which no arm matches and 1.0's kind does not accept
|
|
48
|
+
--> history/1.0.thema:8:9
|
|
49
|
+
|
|
|
50
|
+
8 | kind: _match(v0_0.kind, {
|
|
51
|
+
| ^^^^^^
|
|
52
|
+
|
|
|
53
|
+
= help: add an arm for "c", or a [_] arm
|
|
54
|
+
```
|
package/errors/E0352.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0352: a _match passes values through to a target the lens cannot test them against
|
|
4
|
+
|
|
5
|
+
A value no arm of a match matches passes through where the target accepts it.
|
|
6
|
+
To decide that, the compiler tests the source's values against the target
|
|
7
|
+
field's type, which must be self-contained: a type that refers to other fields
|
|
8
|
+
cannot be tested on its own. Match every value with an arm, or add a `[_]`
|
|
9
|
+
arm.
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
`ship/history/0.0.thema`:
|
|
14
|
+
|
|
15
|
+
```cue
|
|
16
|
+
Schema: {
|
|
17
|
+
kind: "a" | "b" | "c"
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`ship/history/1.0.thema`:
|
|
22
|
+
|
|
23
|
+
```cue
|
|
24
|
+
Schema: {
|
|
25
|
+
allowed: [...string]
|
|
26
|
+
kind: or(allowed)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
ForwardLens: {
|
|
30
|
+
v0_0: _
|
|
31
|
+
v1_0: {
|
|
32
|
+
allowed: ["a", "b"]
|
|
33
|
+
kind: _match(v0_0.kind, {
|
|
34
|
+
"c": "a"
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`ship/tip.thema`:
|
|
41
|
+
|
|
42
|
+
```cue
|
|
43
|
+
Schema: {
|
|
44
|
+
allowed: [...string]
|
|
45
|
+
kind: or(allowed)
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
thema reports:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
error[E0352]: _match on kind: 1.0's kind is not a self-contained type
|
|
53
|
+
--> history/1.0.thema:10:9
|
|
54
|
+
|
|
|
55
|
+
10 | kind: _match(v0_0.kind, {
|
|
56
|
+
| ^^^^^^
|
|
57
|
+
|
|
|
58
|
+
= note: a value no arm matches passes through where the target accepts it, which cannot be tested against a type that refers to other fields
|
|
59
|
+
= help: match every value with an arm, or add a [_] arm
|
|
60
|
+
```
|
package/errors/E0353.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0353: an _each maps something other than an open list to an open list
|
|
4
|
+
|
|
5
|
+
each maps the elements of an open list, `[...T]`, in the source to an open list
|
|
6
|
+
in the target, element by element. A source field that is not a list has no
|
|
7
|
+
elements to map.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
name: string
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`ship/history/1.0.thema`:
|
|
20
|
+
|
|
21
|
+
```cue
|
|
22
|
+
Schema: {
|
|
23
|
+
names: [...string]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ForwardLens: {
|
|
27
|
+
v0_0: _
|
|
28
|
+
v1_0: {
|
|
29
|
+
names: _each(v0_0.name, {
|
|
30
|
+
item
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`ship/tip.thema`:
|
|
37
|
+
|
|
38
|
+
```cue
|
|
39
|
+
Schema: {
|
|
40
|
+
names: [...string]
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
thema reports:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
error[E0353]: _each maps a list to a list; 0.0's name and 1.0's names must both be lists
|
|
48
|
+
--> history/1.0.thema:8:10
|
|
49
|
+
|
|
|
50
|
+
8 | names: _each(v0_0.name, {
|
|
51
|
+
| ^^^^^
|
|
52
|
+
|
|
|
53
|
+
```
|
package/errors/E0354.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0354: the first version has a lens
|
|
4
|
+
|
|
5
|
+
A lens maps between a version and its predecessor. The first version has no
|
|
6
|
+
predecessor, so a lens in its file has nothing to map from.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
a: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ForwardLens: {
|
|
18
|
+
v0_0: _
|
|
19
|
+
v0_0: {
|
|
20
|
+
a: "x"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`ship/tip.thema`:
|
|
26
|
+
|
|
27
|
+
```cue
|
|
28
|
+
Schema: {
|
|
29
|
+
a: string
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
thema reports:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
error[E0354]: history/0.0.thema is the first version, and has no previous version to map from
|
|
37
|
+
--> history/0.0.thema:5:1
|
|
38
|
+
|
|
|
39
|
+
5 | ForwardLens: {
|
|
40
|
+
| ^^^^^^^^^^^
|
|
41
|
+
|
|
|
42
|
+
= help: remove the lens; a lens maps between a version and its predecessor
|
|
43
|
+
```
|
package/errors/E0355.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0355: a minor version has a ForwardLens
|
|
4
|
+
|
|
5
|
+
A minor version is backward compatible with its predecessor, so an instance of
|
|
6
|
+
the predecessor is already an instance of it: translating forward is implicit,
|
|
7
|
+
and a minor version's file has no ForwardLens.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
a: string
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`ship/history/0.1.thema`:
|
|
20
|
+
|
|
21
|
+
```cue
|
|
22
|
+
Schema: {
|
|
23
|
+
a: string
|
|
24
|
+
b?: int
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ForwardLens: {
|
|
28
|
+
v0_0: _
|
|
29
|
+
v0_1: {
|
|
30
|
+
b: 1
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`ship/tip.thema`:
|
|
36
|
+
|
|
37
|
+
```cue
|
|
38
|
+
Schema: {
|
|
39
|
+
a: string
|
|
40
|
+
b?: int
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
thema reports:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
error[E0355]: history/0.1.thema is backward compatible with 0.0, so it has no ForwardLens
|
|
48
|
+
--> history/0.1.thema:6:1
|
|
49
|
+
|
|
|
50
|
+
6 | ForwardLens: {
|
|
51
|
+
| ^^^^^^^^^^^
|
|
52
|
+
|
|
|
53
|
+
= note: an instance of a version is already an instance of its minor successor; translating forward is implicit
|
|
54
|
+
= help: remove the ForwardLens, or make a breaking change
|
|
55
|
+
```
|
package/errors/E0356.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0356: a normal-form lens is outside what the authoring form expresses
|
|
4
|
+
|
|
5
|
+
Decompile turns a normal-form lineage back into version files. It expresses
|
|
6
|
+
exactly the lenses the compiler produces. A lacuna in the authoring form
|
|
7
|
+
describes one field, so a normal-form lacuna over several is outside that, and
|
|
8
|
+
Decompile refuses it rather than approximate.
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
`lineage.cue`:
|
|
13
|
+
|
|
14
|
+
```cue
|
|
15
|
+
name: "ship"
|
|
16
|
+
schemas: {
|
|
17
|
+
"0": {
|
|
18
|
+
"0": {
|
|
19
|
+
schema: {
|
|
20
|
+
a: string
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
"1": {
|
|
25
|
+
"0": {
|
|
26
|
+
schema: {
|
|
27
|
+
a: string
|
|
28
|
+
n: int
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
lenses: {
|
|
34
|
+
"0.0->1.0": {
|
|
35
|
+
v0_0: _
|
|
36
|
+
v1_0: {
|
|
37
|
+
a: v0_0.a
|
|
38
|
+
n: 0
|
|
39
|
+
}
|
|
40
|
+
lacunas: [{
|
|
41
|
+
targetFields: [{path: "a", value: v1_0.a}, {path: "n", value: v1_0.n}]
|
|
42
|
+
message: "n is a placeholder"
|
|
43
|
+
type: "Placeholder"
|
|
44
|
+
}]
|
|
45
|
+
}
|
|
46
|
+
"1.0->0.0": {
|
|
47
|
+
v1_0: _
|
|
48
|
+
v0_0: {
|
|
49
|
+
a: v1_0.a
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
thema reports:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
error[E0356]: lens 0.0->1.0 is outside the authoring form: a lacuna over several fields
|
|
59
|
+
--> lineage.cue:1:1
|
|
60
|
+
|
|
|
61
|
+
1 | name: "ship"
|
|
62
|
+
| ^^^^
|
|
63
|
+
|
|
|
64
|
+
= help: the authoring form expresses the lenses Compile produces: mappings that copy and compute, and _drop, _coalesce, _match and _each
|
|
65
|
+
```
|