@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/E0412.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0412: a lacunas key names a mapping the lens does not have
|
|
4
|
+
|
|
5
|
+
A lacunas key names a mapping of the lens. A key that names none is usually a
|
|
6
|
+
typo. A derived mapping, such as the backward drop of a field the version
|
|
7
|
+
added, is not one: to refine its lacuna, write the drop.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
firstfield: string
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`ship/history/1.0.thema`:
|
|
20
|
+
|
|
21
|
+
```cue
|
|
22
|
+
Schema: {
|
|
23
|
+
firstfield: string
|
|
24
|
+
secondfield: int
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ForwardLens: {
|
|
28
|
+
v0_0: _
|
|
29
|
+
v1_0: {
|
|
30
|
+
secondfield: -1
|
|
31
|
+
}
|
|
32
|
+
lacunas: {
|
|
33
|
+
secondfeild: [{
|
|
34
|
+
type: Placeholder
|
|
35
|
+
message: "-1 is a placeholder"
|
|
36
|
+
}]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`ship/tip.thema`:
|
|
42
|
+
|
|
43
|
+
```cue
|
|
44
|
+
Schema: {
|
|
45
|
+
firstfield: string
|
|
46
|
+
secondfield: int
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
thema reports:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
error[E0412]: lacunas.secondfeild: ForwardLens has no mapping keyed secondfeild
|
|
54
|
+
--> history/1.0.thema:12:17
|
|
55
|
+
|
|
|
56
|
+
12 | secondfeild: [{
|
|
57
|
+
| ^
|
|
58
|
+
|
|
|
59
|
+
```
|
package/errors/E0413.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0413: a lacuna on a mapping inside _each
|
|
4
|
+
|
|
5
|
+
A lacuna on a mapping inside an each body would have to aggregate over the
|
|
6
|
+
list's elements. That is not supported yet; only a DroppedField lacuna on a
|
|
7
|
+
drop inside the body is, refining the drop's own.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
items: [...{
|
|
16
|
+
title?: string
|
|
17
|
+
}]
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`ship/history/1.0.thema`:
|
|
22
|
+
|
|
23
|
+
```cue
|
|
24
|
+
Schema: {
|
|
25
|
+
items: [...{
|
|
26
|
+
name: string
|
|
27
|
+
}]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ForwardLens: {
|
|
31
|
+
v0_0: _
|
|
32
|
+
v1_0: {
|
|
33
|
+
items: _each(v0_0.items, {
|
|
34
|
+
name: _coalesce(_item.title, "untitled")
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
lacunas: {
|
|
38
|
+
items: {
|
|
39
|
+
name: [{
|
|
40
|
+
type: Placeholder
|
|
41
|
+
message: "the item had no title"
|
|
42
|
+
}]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
BackwardLens: {
|
|
48
|
+
v1_0: _
|
|
49
|
+
v0_0: {
|
|
50
|
+
items: _each(v1_0.items, {
|
|
51
|
+
title: _item.name
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`ship/tip.thema`:
|
|
58
|
+
|
|
59
|
+
```cue
|
|
60
|
+
Schema: {
|
|
61
|
+
items: [...{name: string}]
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
thema reports:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
error[E0413]: lacunas.items.name: a lacuna on a mapping inside _each is not supported yet; a DroppedField lacuna on a _drop refines the _drop's
|
|
69
|
+
--> history/1.0.thema:16:11
|
|
70
|
+
|
|
|
71
|
+
16 | name: [{
|
|
72
|
+
| ^
|
|
73
|
+
|
|
|
74
|
+
```
|
package/errors/E0414.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0414: a _match's catch-all arm has no lacuna
|
|
4
|
+
|
|
5
|
+
A match's `[_]` arm collapses every value no other arm matches into one, which
|
|
6
|
+
loses information. It must say so, with a lacuna keyed by the mapping.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
kind: string
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`ship/history/1.0.thema`:
|
|
19
|
+
|
|
20
|
+
```cue
|
|
21
|
+
Schema: {
|
|
22
|
+
kind: int
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ForwardLens: {
|
|
26
|
+
v0_0: _
|
|
27
|
+
v1_0: {
|
|
28
|
+
kind: _match(v0_0.kind, {
|
|
29
|
+
"a": 1
|
|
30
|
+
[_]: 0
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`ship/tip.thema`:
|
|
37
|
+
|
|
38
|
+
```cue
|
|
39
|
+
Schema: {
|
|
40
|
+
kind: int
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
thema reports:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
error[E0414]: the [_] arm collapses every unmatched value into one: declare what is lost in lacunas: {kind: [{type: Type, message: "..."}]}
|
|
48
|
+
--> history/1.0.thema:10:4
|
|
49
|
+
|
|
|
50
|
+
10 | [_]: 0
|
|
51
|
+
| ^
|
|
52
|
+
|
|
|
53
|
+
```
|
package/errors/E0415.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0415: a lacuna on _each has no when
|
|
4
|
+
|
|
5
|
+
A lacuna applies under the condition its mapping implies; an each implies
|
|
6
|
+
none, since it maps every element. A lacuna on an each says when it applies
|
|
7
|
+
with `when`.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
items: [...{
|
|
16
|
+
title: string
|
|
17
|
+
}]
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`ship/history/1.0.thema`:
|
|
22
|
+
|
|
23
|
+
```cue
|
|
24
|
+
Schema: {
|
|
25
|
+
items: [...{
|
|
26
|
+
name: string
|
|
27
|
+
}]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ForwardLens: {
|
|
31
|
+
v0_0: _
|
|
32
|
+
v1_0: {
|
|
33
|
+
items: _each(v0_0.items, {
|
|
34
|
+
name: _item.title
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
lacunas: {
|
|
38
|
+
items: [{
|
|
39
|
+
type: LossyFieldMapping
|
|
40
|
+
message: "titles were renamed"
|
|
41
|
+
}]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
BackwardLens: {
|
|
46
|
+
v1_0: _
|
|
47
|
+
v0_0: {
|
|
48
|
+
items: _each(v1_0.items, {
|
|
49
|
+
title: _item.name
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`ship/tip.thema`:
|
|
56
|
+
|
|
57
|
+
```cue
|
|
58
|
+
Schema: {
|
|
59
|
+
items: [...{name: string}]
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
thema reports:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
error[E0415]: lacunas.items: a lacuna on _each needs when: <condition>
|
|
67
|
+
--> history/1.0.thema:15:11
|
|
68
|
+
|
|
|
69
|
+
15 | items: [{
|
|
70
|
+
| ^
|
|
71
|
+
|
|
|
72
|
+
```
|
package/errors/E0416.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0416: a _drop has a lacuna that is not its one DroppedField refinement
|
|
4
|
+
|
|
5
|
+
A drop derives a DroppedField lacuna of its own; a DroppedField lacuna written
|
|
6
|
+
on the drop refines that one's message, so there is at most one.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
a: string
|
|
15
|
+
b: int
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`ship/history/1.0.thema`:
|
|
20
|
+
|
|
21
|
+
```cue
|
|
22
|
+
Schema: {
|
|
23
|
+
a: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ForwardLens: {
|
|
27
|
+
v0_0: _
|
|
28
|
+
v1_0: {
|
|
29
|
+
b: _drop
|
|
30
|
+
}
|
|
31
|
+
lacunas: {
|
|
32
|
+
b: [{
|
|
33
|
+
type: DroppedField
|
|
34
|
+
message: "b is gone"
|
|
35
|
+
}, {
|
|
36
|
+
type: DroppedField
|
|
37
|
+
message: "b is really gone"
|
|
38
|
+
}]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
BackwardLens: {
|
|
43
|
+
v1_0: _
|
|
44
|
+
v0_0: {
|
|
45
|
+
b: 0
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`ship/tip.thema`:
|
|
51
|
+
|
|
52
|
+
```cue
|
|
53
|
+
Schema: {
|
|
54
|
+
a: string
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
thema reports:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
error[E0416]: lacunas.b: a _drop has one DroppedField lacuna, which refines the one it derives
|
|
62
|
+
--> history/1.0.thema:14:6
|
|
63
|
+
|
|
|
64
|
+
14 | }, {
|
|
65
|
+
| ^
|
|
66
|
+
|
|
|
67
|
+
```
|
package/errors/E0418.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0418: a condition refers to a name a lens does not define
|
|
4
|
+
|
|
5
|
+
A lacuna's `when` refers to the lens's source instance and to CUE's builtins,
|
|
6
|
+
and to nothing else. A bare name that is neither is undefined.
|
|
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
|
+
ForwardLens: {
|
|
27
|
+
v0_0: _
|
|
28
|
+
v1_0: {
|
|
29
|
+
b: 0
|
|
30
|
+
}
|
|
31
|
+
lacunas: {
|
|
32
|
+
b: [{
|
|
33
|
+
type: Placeholder
|
|
34
|
+
message: "0 is a placeholder"
|
|
35
|
+
when: threshold > 1
|
|
36
|
+
}]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`ship/tip.thema`:
|
|
42
|
+
|
|
43
|
+
```cue
|
|
44
|
+
Schema: {
|
|
45
|
+
a: string
|
|
46
|
+
b: int
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
thema reports:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
error[E0418]: threshold is not defined in a lens; an expression refers to v0_0, to len, quo, rem, div, mod and to the strings functions
|
|
54
|
+
--> history/1.0.thema:15:13
|
|
55
|
+
|
|
|
56
|
+
15 | when: threshold > 1
|
|
57
|
+
| ^^^^^^^^^
|
|
58
|
+
|
|
|
59
|
+
```
|
package/errors/E0420.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0420: a lacuna on a _match with no catch-all arm has no when
|
|
4
|
+
|
|
5
|
+
A lacuna on a match applies when its `[_]` arm does. A match with no `[_]`
|
|
6
|
+
arm implies no condition, so a lacuna on it must say when it applies with
|
|
7
|
+
`when`.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
aunion: *"foo" | "bar" | "baz"
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`ship/history/1.0.thema`:
|
|
20
|
+
|
|
21
|
+
```cue
|
|
22
|
+
Schema: {
|
|
23
|
+
aunion: "foo" | *"bar" | "baz"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ForwardLens: {
|
|
27
|
+
v0_0: _
|
|
28
|
+
v1_0: {
|
|
29
|
+
aunion: _match(v0_0.aunion, {"foo": "bar"})
|
|
30
|
+
}
|
|
31
|
+
lacunas: {
|
|
32
|
+
aunion: [{
|
|
33
|
+
type: ChangedDefault
|
|
34
|
+
message: "the default changed"
|
|
35
|
+
}]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
BackwardLens: {
|
|
40
|
+
v1_0: _
|
|
41
|
+
v0_0: {
|
|
42
|
+
aunion: _match(v1_0.aunion, {"bar": "foo"})
|
|
43
|
+
}
|
|
44
|
+
lacunas: {
|
|
45
|
+
aunion: [{
|
|
46
|
+
type: ChangedDefault
|
|
47
|
+
message: "the default changed"
|
|
48
|
+
when: v1_0.aunion == "bar"
|
|
49
|
+
}]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`ship/tip.thema`:
|
|
55
|
+
|
|
56
|
+
```cue
|
|
57
|
+
Schema: {
|
|
58
|
+
aunion: "foo" | *"bar" | "baz"
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
thema reports:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
error[E0420]: lacunas.aunion: a lacuna on a _match applies when its [_] arm does, and this _match has none: say when it applies with when: <condition>
|
|
66
|
+
--> history/1.0.thema:11:12
|
|
67
|
+
|
|
|
68
|
+
11 | aunion: [{
|
|
69
|
+
| ^
|
|
70
|
+
|
|
|
71
|
+
```
|
package/errors/E0421.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0421: a lacuna on a _drop inside _each has a when
|
|
4
|
+
|
|
5
|
+
A drop inside an each body aggregates over the list: its lacuna applies when
|
|
6
|
+
any element had the field. Such a lacuna has no `when` of its own.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
9
|
+
|
|
10
|
+
`ship/history/0.0.thema`:
|
|
11
|
+
|
|
12
|
+
```cue
|
|
13
|
+
Schema: {
|
|
14
|
+
items: [...{
|
|
15
|
+
name: string
|
|
16
|
+
legacy?: string
|
|
17
|
+
}]
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`ship/history/1.0.thema`:
|
|
22
|
+
|
|
23
|
+
```cue
|
|
24
|
+
Schema: {
|
|
25
|
+
items: [...{
|
|
26
|
+
name: string
|
|
27
|
+
}]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ForwardLens: {
|
|
31
|
+
v0_0: _
|
|
32
|
+
v1_0: {
|
|
33
|
+
items: _each(v0_0.items, {
|
|
34
|
+
legacy: _drop
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
lacunas: {
|
|
38
|
+
items: {
|
|
39
|
+
legacy: [{
|
|
40
|
+
type: DroppedField
|
|
41
|
+
message: "legacy was dropped"
|
|
42
|
+
when: len(v0_0.items) > 1
|
|
43
|
+
}]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
BackwardLens: {
|
|
49
|
+
v1_0: _
|
|
50
|
+
v0_0: {
|
|
51
|
+
items: _each(v1_0.items, {
|
|
52
|
+
name: _item.name
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`ship/tip.thema`:
|
|
59
|
+
|
|
60
|
+
```cue
|
|
61
|
+
Schema: {
|
|
62
|
+
items: [...{name: string}]
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
thema reports:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
error[E0421]: lacunas.items.legacy: a _drop inside _each aggregates over the list, and its lacuna has no when
|
|
70
|
+
--> history/1.0.thema:19:14
|
|
71
|
+
|
|
|
72
|
+
19 | when: len(v0_0.items) > 1
|
|
73
|
+
| ^^^
|
|
74
|
+
|
|
|
75
|
+
|
|
76
|
+
error[E0413]: lacunas.items.legacy: a lacuna on a mapping inside _each is not supported yet; a DroppedField lacuna on a _drop refines the _drop's
|
|
77
|
+
--> history/1.0.thema:16:13
|
|
78
|
+
|
|
|
79
|
+
16 | legacy: [{
|
|
80
|
+
| ^
|
|
81
|
+
|
|
|
82
|
+
```
|
package/errors/E0422.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0422: a when names a field that is not a condition
|
|
4
|
+
|
|
5
|
+
A when names a field bare, which tests a field's presence when the field is
|
|
6
|
+
optional; a field that is always present is not a condition. Compare it with
|
|
7
|
+
something to make one.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
name: string
|
|
16
|
+
count: int
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`ship/history/1.0.thema`:
|
|
21
|
+
|
|
22
|
+
```cue
|
|
23
|
+
Schema: {
|
|
24
|
+
name: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ForwardLens: {
|
|
28
|
+
v0_0: _
|
|
29
|
+
v1_0: {
|
|
30
|
+
name: v0_0.name
|
|
31
|
+
count: _drop(v0_0.count)
|
|
32
|
+
}
|
|
33
|
+
lacunas: {
|
|
34
|
+
count: [{
|
|
35
|
+
type: DroppedField
|
|
36
|
+
message: "count is gone"
|
|
37
|
+
when: v0_0.name
|
|
38
|
+
}]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
BackwardLens: {
|
|
43
|
+
v1_0: _
|
|
44
|
+
v0_0: {
|
|
45
|
+
name: v1_0.name
|
|
46
|
+
count: 0
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`ship/tip.thema`:
|
|
52
|
+
|
|
53
|
+
```cue
|
|
54
|
+
Schema: {
|
|
55
|
+
name: string
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
thema reports:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
error[E0418]: _drop is not defined in a lens; an expression refers to v0_0, to len, quo, rem, div, mod and to the strings functions
|
|
63
|
+
--> history/1.0.thema:9:10
|
|
64
|
+
|
|
|
65
|
+
9 | count: _drop(v0_0.count)
|
|
66
|
+
| ^^^^^
|
|
67
|
+
|
|
|
68
|
+
|
|
69
|
+
error[E0422]: v0_0.name is string, not a condition: compare it; an optional field named bare tests its presence
|
|
70
|
+
--> history/1.0.thema:15:13
|
|
71
|
+
|
|
|
72
|
+
15 | when: v0_0.name
|
|
73
|
+
| ^^^^
|
|
74
|
+
|
|
|
75
|
+
|
|
76
|
+
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
|
|
77
|
+
--> history/1.0.thema:5:1
|
|
78
|
+
|
|
|
79
|
+
5 | ForwardLens: {
|
|
80
|
+
| ^^^^^^^^^^^
|
|
81
|
+
|
|
|
82
|
+
```
|
package/errors/E0423.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<!-- Generated by go test ./diag; do not edit. -->
|
|
2
|
+
|
|
3
|
+
# E0423: a when tests the presence of a field it also reads
|
|
4
|
+
|
|
5
|
+
A condition that reads an optional field concerns only the instances that
|
|
6
|
+
have it, so testing its presence as well says nothing more. Drop the presence
|
|
7
|
+
test; to test presence alone, name the field bare.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
`ship/history/0.0.thema`:
|
|
12
|
+
|
|
13
|
+
```cue
|
|
14
|
+
Schema: {
|
|
15
|
+
name: string
|
|
16
|
+
count?: int
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`ship/history/1.0.thema`:
|
|
21
|
+
|
|
22
|
+
```cue
|
|
23
|
+
Schema: {
|
|
24
|
+
name: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ForwardLens: {
|
|
28
|
+
v0_0: _
|
|
29
|
+
v1_0: {
|
|
30
|
+
name: v0_0.name
|
|
31
|
+
count: _drop(v0_0.count)
|
|
32
|
+
}
|
|
33
|
+
lacunas: {
|
|
34
|
+
count: [{
|
|
35
|
+
type: DroppedField
|
|
36
|
+
message: "a large count is gone"
|
|
37
|
+
when: v0_0.count != _|_ && v0_0.count > 10
|
|
38
|
+
}]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
BackwardLens: {
|
|
43
|
+
v1_0: _
|
|
44
|
+
v0_0: {
|
|
45
|
+
name: v1_0.name
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`ship/tip.thema`:
|
|
51
|
+
|
|
52
|
+
```cue
|
|
53
|
+
Schema: {
|
|
54
|
+
name: string
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
thema reports:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
error[E0418]: _drop is not defined in a lens; an expression refers to v0_0, to len, quo, rem, div, mod and to the strings functions
|
|
62
|
+
--> history/1.0.thema:9:10
|
|
63
|
+
|
|
|
64
|
+
9 | count: _drop(v0_0.count)
|
|
65
|
+
| ^^^^^
|
|
66
|
+
|
|
|
67
|
+
|
|
68
|
+
error[E0423]: this condition tests the presence of v0_0.count, which it also reads
|
|
69
|
+
--> history/1.0.thema:15:13
|
|
70
|
+
|
|
|
71
|
+
15 | when: v0_0.count != _|_ && v0_0.count > 10
|
|
72
|
+
| ^^^^
|
|
73
|
+
|
|
|
74
|
+
= note: a condition reading an optional field concerns only the instances that have it, so testing its presence says nothing more
|
|
75
|
+
= help: drop the presence test; to test presence alone, write when: v0_0.count
|
|
76
|
+
|
|
77
|
+
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
|
|
78
|
+
--> history/1.0.thema:5:1
|
|
79
|
+
|
|
|
80
|
+
5 | ForwardLens: {
|
|
81
|
+
| ^^^^^^^^^^^
|
|
82
|
+
|
|
|
83
|
+
```
|