Skip to content

Commit fca61f5

Browse files
committed
cue: define all Kind constant values explicitly with that type
go doc (somewhat understandably) fails to see constant values of type Kind unless they are explicitly defined to be of that type, even though Kind is defined as an alias of adt.Kind and the values assigned to those constants are of the type adt.Kind. This is most easily seen by looking at the output of go doc: $ go doc -all Kind package cue // import "." type Kind = adt.Kind Kind determines the underlying type of a Value. const BottomKind Kind = 0 Compare the result of this CL which explicitly assigns the Kind type to all constants: package cue // import "." type Kind = adt.Kind Kind determines the underlying type of a Value. const ( // BottomKind represents the bottom value. BottomKind Kind = adt.BottomKind // NullKind indicates a null value. NullKind Kind = adt.NullKind // BoolKind indicates a boolean value. BoolKind Kind = adt.BoolKind // IntKind represents an integral number. IntKind Kind = adt.IntKind // FloatKind represents a decimal float point number that cannot be // converted to an integer. The underlying number may still be integral, // but resulting from an operation that enforces the float type. FloatKind Kind = adt.FloatKind // StringKind indicates any kind of string. StringKind Kind = adt.StringKind // BytesKind is a blob of data. BytesKind Kind = adt.BytesKind // StructKind is a kev-value map. StructKind Kind = adt.StructKind // ListKind indicates a list of values. ListKind Kind = adt.ListKind // NumberKind represents any kind of number. NumberKind Kind = IntKind | FloatKind // TopKind represents the top value. TopKind Kind = adt.TopKind ) Fixes #1350 Signed-off-by: Paul Jolly <paul@myitcv.io> Change-Id: I94ec605bda0ffdb054a9fe226fb3d5a44607bc9a Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/526636 Unity-Result: CUEcueckoo <cueckoo@cuelang.org> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
1 parent 8031fe7 commit fca61f5

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

cue/types.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,42 +44,44 @@ import (
4444
// Kind determines the underlying type of a Value.
4545
type Kind = adt.Kind
4646

47-
const BottomKind Kind = 0
48-
4947
const (
48+
// BottomKind represents the bottom value.
49+
BottomKind Kind = adt.BottomKind
50+
5051
// NullKind indicates a null value.
5152
NullKind Kind = adt.NullKind
5253

5354
// BoolKind indicates a boolean value.
54-
BoolKind = adt.BoolKind
55+
BoolKind Kind = adt.BoolKind
5556

5657
// IntKind represents an integral number.
57-
IntKind = adt.IntKind
58+
IntKind Kind = adt.IntKind
5859

5960
// FloatKind represents a decimal float point number that cannot be
6061
// converted to an integer. The underlying number may still be integral,
6162
// but resulting from an operation that enforces the float type.
62-
FloatKind = adt.FloatKind
63+
FloatKind Kind = adt.FloatKind
6364

6465
// StringKind indicates any kind of string.
65-
StringKind = adt.StringKind
66+
StringKind Kind = adt.StringKind
6667

6768
// BytesKind is a blob of data.
68-
BytesKind = adt.BytesKind
69+
BytesKind Kind = adt.BytesKind
6970

7071
// StructKind is a kev-value map.
71-
StructKind = adt.StructKind
72+
StructKind Kind = adt.StructKind
7273

7374
// ListKind indicates a list of values.
74-
ListKind = adt.ListKind
75+
ListKind Kind = adt.ListKind
7576

7677
// _numberKind is used as a implementation detail inside
7778
// Kind.String to indicate NumberKind.
7879

7980
// NumberKind represents any kind of number.
80-
NumberKind = IntKind | FloatKind
81+
NumberKind Kind = IntKind | FloatKind
8182

82-
TopKind = adt.TopKind
83+
// TopKind represents the top value.
84+
TopKind Kind = adt.TopKind
8385
)
8486

8587
// An structValue represents a JSON object.

0 commit comments

Comments
 (0)