mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-29 03:08:47 -06:00
Merge pull request #759 from kalman/map-ref-order
Make types.Ref implement the OrderedValue interface.
This commit is contained in:
@@ -496,10 +496,14 @@ func (r RefOfIncident) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfIncident.
|
||||
var __typeForRefOfIncident types.Type
|
||||
|
||||
func (m RefOfIncident) Type() types.Type {
|
||||
func (r RefOfIncident) Type() types.Type {
|
||||
return __typeForRefOfIncident
|
||||
}
|
||||
|
||||
func (r RefOfIncident) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfIncident = types.MakeCompoundType(types.RefKind, types.MakeType(__commonPackageInFile_incident_CachedRef, 0))
|
||||
types.RegisterRef(__typeForRefOfIncident, builderForRefOfIncident)
|
||||
|
||||
@@ -570,10 +570,14 @@ func (r RefOfValue) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfValue.
|
||||
var __typeForRefOfValue types.Type
|
||||
|
||||
func (m RefOfValue) Type() types.Type {
|
||||
func (r RefOfValue) Type() types.Type {
|
||||
return __typeForRefOfValue
|
||||
}
|
||||
|
||||
func (r RefOfValue) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfValue = types.MakeCompoundType(types.RefKind, types.MakePrimitiveType(types.ValueKind))
|
||||
types.RegisterRef(__typeForRefOfValue, builderForRefOfValue)
|
||||
@@ -1181,10 +1185,14 @@ func (r RefOfSQuadTree) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfSQuadTree.
|
||||
var __typeForRefOfSQuadTree types.Type
|
||||
|
||||
func (m RefOfSQuadTree) Type() types.Type {
|
||||
func (r RefOfSQuadTree) Type() types.Type {
|
||||
return __typeForRefOfSQuadTree
|
||||
}
|
||||
|
||||
func (r RefOfSQuadTree) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfSQuadTree = types.MakeCompoundType(types.RefKind, types.MakeType(__commonPackageInFile_quad_tree_CachedRef, 2))
|
||||
types.RegisterRef(__typeForRefOfSQuadTree, builderForRefOfSQuadTree)
|
||||
|
||||
@@ -289,10 +289,14 @@ func (r RefOfMapOfStringToRefOfCompany) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfMapOfStringToRefOfCompany.
|
||||
var __typeForRefOfMapOfStringToRefOfCompany types.Type
|
||||
|
||||
func (m RefOfMapOfStringToRefOfCompany) Type() types.Type {
|
||||
func (r RefOfMapOfStringToRefOfCompany) Type() types.Type {
|
||||
return __typeForRefOfMapOfStringToRefOfCompany
|
||||
}
|
||||
|
||||
func (r RefOfMapOfStringToRefOfCompany) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfMapOfStringToRefOfCompany = types.MakeCompoundType(types.RefKind, types.MakeCompoundType(types.MapKind, types.MakePrimitiveType(types.StringKind), types.MakeCompoundType(types.RefKind, types.MakeType(ref.Parse("sha1-9fb26a609a1d4134935888c9676c79d6ea89acbb"), 0))))
|
||||
types.RegisterRef(__typeForRefOfMapOfStringToRefOfCompany, builderForRefOfMapOfStringToRefOfCompany)
|
||||
@@ -480,10 +484,14 @@ func (r RefOfCompany) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfCompany.
|
||||
var __typeForRefOfCompany types.Type
|
||||
|
||||
func (m RefOfCompany) Type() types.Type {
|
||||
func (r RefOfCompany) Type() types.Type {
|
||||
return __typeForRefOfCompany
|
||||
}
|
||||
|
||||
func (r RefOfCompany) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfCompany = types.MakeCompoundType(types.RefKind, types.MakeType(ref.Parse("sha1-9fb26a609a1d4134935888c9676c79d6ea89acbb"), 0))
|
||||
types.RegisterRef(__typeForRefOfCompany, builderForRefOfCompany)
|
||||
|
||||
@@ -947,10 +947,14 @@ func (r RefOfRound) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfRound.
|
||||
var __typeForRefOfRound types.Type
|
||||
|
||||
func (m RefOfRound) Type() types.Type {
|
||||
func (r RefOfRound) Type() types.Type {
|
||||
return __typeForRefOfRound
|
||||
}
|
||||
|
||||
func (r RefOfRound) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfRound = types.MakeCompoundType(types.RefKind, types.MakeType(__mainPackageInFile_sha1_9fb26a6_CachedRef, 1))
|
||||
types.RegisterRef(__typeForRefOfRound, builderForRefOfRound)
|
||||
|
||||
@@ -898,10 +898,14 @@ func (r RefOfKey) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfKey.
|
||||
var __typeForRefOfKey types.Type
|
||||
|
||||
func (m RefOfKey) Type() types.Type {
|
||||
func (r RefOfKey) Type() types.Type {
|
||||
return __typeForRefOfKey
|
||||
}
|
||||
|
||||
func (r RefOfKey) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfKey = types.MakeCompoundType(types.RefKind, types.MakeType(__mainPackageInFile_index_CachedRef, 2))
|
||||
types.RegisterRef(__typeForRefOfKey, builderForRefOfKey)
|
||||
@@ -1105,10 +1109,14 @@ func (r RefOfSetOfRoundRaise) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfSetOfRoundRaise.
|
||||
var __typeForRefOfSetOfRoundRaise types.Type
|
||||
|
||||
func (m RefOfSetOfRoundRaise) Type() types.Type {
|
||||
func (r RefOfSetOfRoundRaise) Type() types.Type {
|
||||
return __typeForRefOfSetOfRoundRaise
|
||||
}
|
||||
|
||||
func (r RefOfSetOfRoundRaise) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfSetOfRoundRaise = types.MakeCompoundType(types.RefKind, types.MakeCompoundType(types.SetKind, types.MakeType(__mainPackageInFile_index_CachedRef, 4)))
|
||||
types.RegisterRef(__typeForRefOfSetOfRoundRaise, builderForRefOfSetOfRoundRaise)
|
||||
|
||||
@@ -289,10 +289,14 @@ func (r RefOfMapOfStringToRefOfCompany) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfMapOfStringToRefOfCompany.
|
||||
var __typeForRefOfMapOfStringToRefOfCompany types.Type
|
||||
|
||||
func (m RefOfMapOfStringToRefOfCompany) Type() types.Type {
|
||||
func (r RefOfMapOfStringToRefOfCompany) Type() types.Type {
|
||||
return __typeForRefOfMapOfStringToRefOfCompany
|
||||
}
|
||||
|
||||
func (r RefOfMapOfStringToRefOfCompany) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfMapOfStringToRefOfCompany = types.MakeCompoundType(types.RefKind, types.MakeCompoundType(types.MapKind, types.MakePrimitiveType(types.StringKind), types.MakeCompoundType(types.RefKind, types.MakeType(ref.Parse("sha1-9fb26a609a1d4134935888c9676c79d6ea89acbb"), 0))))
|
||||
types.RegisterRef(__typeForRefOfMapOfStringToRefOfCompany, builderForRefOfMapOfStringToRefOfCompany)
|
||||
@@ -480,10 +484,14 @@ func (r RefOfCompany) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfCompany.
|
||||
var __typeForRefOfCompany types.Type
|
||||
|
||||
func (m RefOfCompany) Type() types.Type {
|
||||
func (r RefOfCompany) Type() types.Type {
|
||||
return __typeForRefOfCompany
|
||||
}
|
||||
|
||||
func (r RefOfCompany) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfCompany = types.MakeCompoundType(types.RefKind, types.MakeType(ref.Parse("sha1-9fb26a609a1d4134935888c9676c79d6ea89acbb"), 0))
|
||||
types.RegisterRef(__typeForRefOfCompany, builderForRefOfCompany)
|
||||
|
||||
@@ -947,10 +947,14 @@ func (r RefOfRound) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfRound.
|
||||
var __typeForRefOfRound types.Type
|
||||
|
||||
func (m RefOfRound) Type() types.Type {
|
||||
func (r RefOfRound) Type() types.Type {
|
||||
return __typeForRefOfRound
|
||||
}
|
||||
|
||||
func (r RefOfRound) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfRound = types.MakeCompoundType(types.RefKind, types.MakeType(__mainPackageInFile_sha1_9fb26a6_CachedRef, 1))
|
||||
types.RegisterRef(__typeForRefOfRound, builderForRefOfRound)
|
||||
|
||||
@@ -503,10 +503,14 @@ func (r RefOfUser) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfUser.
|
||||
var __typeForRefOfUser types.Type
|
||||
|
||||
func (m RefOfUser) Type() types.Type {
|
||||
func (r RefOfUser) Type() types.Type {
|
||||
return __typeForRefOfUser
|
||||
}
|
||||
|
||||
func (r RefOfUser) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfUser = types.MakeCompoundType(types.RefKind, types.MakeType(__mainPackageInFile_types_CachedRef, 0))
|
||||
types.RegisterRef(__typeForRefOfUser, builderForRefOfUser)
|
||||
@@ -560,10 +564,14 @@ func (r RefOfSetOfRefOfRemotePhoto) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfSetOfRefOfRemotePhoto.
|
||||
var __typeForRefOfSetOfRefOfRemotePhoto types.Type
|
||||
|
||||
func (m RefOfSetOfRefOfRemotePhoto) Type() types.Type {
|
||||
func (r RefOfSetOfRefOfRemotePhoto) Type() types.Type {
|
||||
return __typeForRefOfSetOfRefOfRemotePhoto
|
||||
}
|
||||
|
||||
func (r RefOfSetOfRefOfRemotePhoto) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfSetOfRefOfRemotePhoto = types.MakeCompoundType(types.RefKind, types.MakeCompoundType(types.SetKind, types.MakeCompoundType(types.RefKind, types.MakeType(ref.Parse("sha1-42722c55cec055ff32526d1dc0636fa4d48c9fd5"), 0))))
|
||||
types.RegisterRef(__typeForRefOfSetOfRefOfRemotePhoto, builderForRefOfSetOfRefOfRemotePhoto)
|
||||
@@ -767,10 +775,14 @@ func (r RefOfRemotePhoto) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfRemotePhoto.
|
||||
var __typeForRefOfRemotePhoto types.Type
|
||||
|
||||
func (m RefOfRemotePhoto) Type() types.Type {
|
||||
func (r RefOfRemotePhoto) Type() types.Type {
|
||||
return __typeForRefOfRemotePhoto
|
||||
}
|
||||
|
||||
func (r RefOfRemotePhoto) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfRemotePhoto = types.MakeCompoundType(types.RefKind, types.MakeType(ref.Parse("sha1-42722c55cec055ff32526d1dc0636fa4d48c9fd5"), 0))
|
||||
types.RegisterRef(__typeForRefOfRemotePhoto, builderForRefOfRemotePhoto)
|
||||
|
||||
@@ -672,10 +672,14 @@ func (r RefOfUser) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfUser.
|
||||
var __typeForRefOfUser types.Type
|
||||
|
||||
func (m RefOfUser) Type() types.Type {
|
||||
func (r RefOfUser) Type() types.Type {
|
||||
return __typeForRefOfUser
|
||||
}
|
||||
|
||||
func (r RefOfUser) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfUser = types.MakeCompoundType(types.RefKind, types.MakeType(__mainPackageInFile_picasa_CachedRef, 0))
|
||||
types.RegisterRef(__typeForRefOfUser, builderForRefOfUser)
|
||||
@@ -729,10 +733,14 @@ func (r RefOfSetOfRefOfRemotePhoto) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfSetOfRefOfRemotePhoto.
|
||||
var __typeForRefOfSetOfRefOfRemotePhoto types.Type
|
||||
|
||||
func (m RefOfSetOfRefOfRemotePhoto) Type() types.Type {
|
||||
func (r RefOfSetOfRefOfRemotePhoto) Type() types.Type {
|
||||
return __typeForRefOfSetOfRefOfRemotePhoto
|
||||
}
|
||||
|
||||
func (r RefOfSetOfRefOfRemotePhoto) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfSetOfRefOfRemotePhoto = types.MakeCompoundType(types.RefKind, types.MakeCompoundType(types.SetKind, types.MakeCompoundType(types.RefKind, types.MakeType(ref.Parse("sha1-42722c55cec055ff32526d1dc0636fa4d48c9fd5"), 0))))
|
||||
types.RegisterRef(__typeForRefOfSetOfRefOfRemotePhoto, builderForRefOfSetOfRefOfRemotePhoto)
|
||||
@@ -936,10 +944,14 @@ func (r RefOfRemotePhoto) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfRemotePhoto.
|
||||
var __typeForRefOfRemotePhoto types.Type
|
||||
|
||||
func (m RefOfRemotePhoto) Type() types.Type {
|
||||
func (r RefOfRemotePhoto) Type() types.Type {
|
||||
return __typeForRefOfRemotePhoto
|
||||
}
|
||||
|
||||
func (r RefOfRemotePhoto) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfRemotePhoto = types.MakeCompoundType(types.RefKind, types.MakeType(ref.Parse("sha1-42722c55cec055ff32526d1dc0636fa4d48c9fd5"), 0))
|
||||
types.RegisterRef(__typeForRefOfRemotePhoto, builderForRefOfRemotePhoto)
|
||||
|
||||
@@ -447,10 +447,14 @@ func (r RefOfMapOfStringToValue) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfMapOfStringToValue.
|
||||
var __typeForRefOfMapOfStringToValue types.Type
|
||||
|
||||
func (m RefOfMapOfStringToValue) Type() types.Type {
|
||||
func (r RefOfMapOfStringToValue) Type() types.Type {
|
||||
return __typeForRefOfMapOfStringToValue
|
||||
}
|
||||
|
||||
func (r RefOfMapOfStringToValue) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfMapOfStringToValue = types.MakeCompoundType(types.RefKind, types.MakeCompoundType(types.MapKind, types.MakePrimitiveType(types.StringKind), types.MakePrimitiveType(types.ValueKind)))
|
||||
types.RegisterRef(__typeForRefOfMapOfStringToValue, builderForRefOfMapOfStringToValue)
|
||||
@@ -781,10 +785,14 @@ func (r RefOfListOfPitch) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfListOfPitch.
|
||||
var __typeForRefOfListOfPitch types.Type
|
||||
|
||||
func (m RefOfListOfPitch) Type() types.Type {
|
||||
func (r RefOfListOfPitch) Type() types.Type {
|
||||
return __typeForRefOfListOfPitch
|
||||
}
|
||||
|
||||
func (r RefOfListOfPitch) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfListOfPitch = types.MakeCompoundType(types.RefKind, types.MakeCompoundType(types.ListKind, types.MakeType(__mainPackageInFile_types_CachedRef, 0)))
|
||||
types.RegisterRef(__typeForRefOfListOfPitch, builderForRefOfListOfPitch)
|
||||
|
||||
@@ -328,10 +328,14 @@ func (r RefOfRemotePhoto) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfRemotePhoto.
|
||||
var __typeForRefOfRemotePhoto types.Type
|
||||
|
||||
func (m RefOfRemotePhoto) Type() types.Type {
|
||||
func (r RefOfRemotePhoto) Type() types.Type {
|
||||
return __typeForRefOfRemotePhoto
|
||||
}
|
||||
|
||||
func (r RefOfRemotePhoto) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfRemotePhoto = types.MakeCompoundType(types.RefKind, types.MakeType(ref.Parse("sha1-42722c55cec055ff32526d1dc0636fa4d48c9fd5"), 0))
|
||||
types.RegisterRef(__typeForRefOfRemotePhoto, builderForRefOfRemotePhoto)
|
||||
|
||||
@@ -187,10 +187,14 @@ func (r RefOfMapOfStringToValue) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfMapOfStringToValue.
|
||||
var __typeForRefOfMapOfStringToValue types.Type
|
||||
|
||||
func (m RefOfMapOfStringToValue) Type() types.Type {
|
||||
func (r RefOfMapOfStringToValue) Type() types.Type {
|
||||
return __typeForRefOfMapOfStringToValue
|
||||
}
|
||||
|
||||
func (r RefOfMapOfStringToValue) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfMapOfStringToValue = types.MakeCompoundType(types.RefKind, types.MakeCompoundType(types.MapKind, types.MakePrimitiveType(types.StringKind), types.MakePrimitiveType(types.ValueKind)))
|
||||
types.RegisterRef(__typeForRefOfMapOfStringToValue, builderForRefOfMapOfStringToValue)
|
||||
|
||||
@@ -456,10 +456,14 @@ func (r RefOfCommit) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfCommit.
|
||||
var __typeForRefOfCommit types.Type
|
||||
|
||||
func (m RefOfCommit) Type() types.Type {
|
||||
func (r RefOfCommit) Type() types.Type {
|
||||
return __typeForRefOfCommit
|
||||
}
|
||||
|
||||
func (r RefOfCommit) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfCommit = types.MakeCompoundType(types.RefKind, types.MakeType(__datasPackageInFile_types_CachedRef, 0))
|
||||
types.RegisterRef(__typeForRefOfCommit, builderForRefOfCommit)
|
||||
|
||||
@@ -36,10 +36,14 @@ func (r {{.Name}}) ChildValues() []{{$typesPackage}}Value {
|
||||
// A Noms Value that describes {{.Name}}.
|
||||
var __typeFor{{.Name}} {{$typesPackage}}Type
|
||||
|
||||
func (m {{.Name}}) Type() {{$typesPackage}}Type {
|
||||
func (r {{.Name}}) Type() {{$typesPackage}}Type {
|
||||
return __typeFor{{.Name}}
|
||||
}
|
||||
|
||||
func (r {{.Name}}) Less(other {{$typesPackage}}OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.({{$typesPackage}}RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeFor{{.Name}} = {{toTypesType .Type .FileID .PackageName}}
|
||||
{{$typesPackage}}RegisterRef(__typeFor{{.Name}}, builderFor{{.Name}})
|
||||
|
||||
@@ -151,10 +151,14 @@ func (r RefOfListOfString) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfListOfString.
|
||||
var __typeForRefOfListOfString types.Type
|
||||
|
||||
func (m RefOfListOfString) Type() types.Type {
|
||||
func (r RefOfListOfString) Type() types.Type {
|
||||
return __typeForRefOfListOfString
|
||||
}
|
||||
|
||||
func (r RefOfListOfString) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfListOfString = types.MakeCompoundType(types.RefKind, types.MakeCompoundType(types.ListKind, types.MakePrimitiveType(types.StringKind)))
|
||||
types.RegisterRef(__typeForRefOfListOfString, builderForRefOfListOfString)
|
||||
@@ -351,10 +355,14 @@ func (r RefOfSetOfFloat32) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfSetOfFloat32.
|
||||
var __typeForRefOfSetOfFloat32 types.Type
|
||||
|
||||
func (m RefOfSetOfFloat32) Type() types.Type {
|
||||
func (r RefOfSetOfFloat32) Type() types.Type {
|
||||
return __typeForRefOfSetOfFloat32
|
||||
}
|
||||
|
||||
func (r RefOfSetOfFloat32) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfSetOfFloat32 = types.MakeCompoundType(types.RefKind, types.MakeCompoundType(types.SetKind, types.MakePrimitiveType(types.Float32Kind)))
|
||||
types.RegisterRef(__typeForRefOfSetOfFloat32, builderForRefOfSetOfFloat32)
|
||||
@@ -551,10 +559,14 @@ func (r RefOfFloat32) ChildValues() []types.Value {
|
||||
// A Noms Value that describes RefOfFloat32.
|
||||
var __typeForRefOfFloat32 types.Type
|
||||
|
||||
func (m RefOfFloat32) Type() types.Type {
|
||||
func (r RefOfFloat32) Type() types.Type {
|
||||
return __typeForRefOfFloat32
|
||||
}
|
||||
|
||||
func (r RefOfFloat32) Less(other types.OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(types.RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfFloat32 = types.MakeCompoundType(types.RefKind, types.MakePrimitiveType(types.Float32Kind))
|
||||
types.RegisterRef(__typeForRefOfFloat32, builderForRefOfFloat32)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
pigeon "${1}" | goimports > "${1}".go
|
||||
"$GOPATH/bin/pigeon" "${1}" | "$GOPATH/bin/goimports" > "${1}".go
|
||||
|
||||
@@ -9,154 +9,153 @@ import (
|
||||
"github.com/attic-labs/noms/chunks"
|
||||
)
|
||||
|
||||
type testNativeOrderMap []mapEntry
|
||||
|
||||
func (tm testNativeOrderMap) Len() int {
|
||||
return len(tm)
|
||||
type testMap struct {
|
||||
entries []mapEntry
|
||||
less testMapLessFn
|
||||
tr Type
|
||||
}
|
||||
|
||||
func (tm testNativeOrderMap) Less(i, j int) bool {
|
||||
return tm[i].key.(OrderedValue).Less(tm[j].key.(OrderedValue))
|
||||
type testMapLessFn func(x, y Value) bool
|
||||
|
||||
func (tm testMap) Len() int {
|
||||
return len(tm.entries)
|
||||
}
|
||||
|
||||
func (tm testNativeOrderMap) Swap(i, j int) {
|
||||
tm[i], tm[j] = tm[j], tm[i]
|
||||
func (tm testMap) Less(i, j int) bool {
|
||||
return tm.less(tm.entries[i].key, tm.entries[j].key)
|
||||
}
|
||||
|
||||
func getTestNativeOrderMap() ([]mapEntry, []Value) {
|
||||
length := int(mapPattern * 16)
|
||||
s := rand.NewSource(42)
|
||||
func (tm testMap) Swap(i, j int) {
|
||||
tm.entries[i], tm.entries[j] = tm.entries[j], tm.entries[i]
|
||||
}
|
||||
|
||||
func (tm testMap) toCompoundMap(cs chunks.ChunkStore) compoundMap {
|
||||
keyvals := []Value{}
|
||||
for _, entry := range tm.entries {
|
||||
keyvals = append(keyvals, entry.key, entry.value)
|
||||
}
|
||||
return NewTypedMap(cs, tm.tr, keyvals...).(compoundMap)
|
||||
}
|
||||
|
||||
type testMapGenFn func(v Int64) Value
|
||||
|
||||
func newTestMap(length int, gen testMapGenFn, less testMapLessFn, tr Type) testMap {
|
||||
s := rand.NewSource(4242)
|
||||
used := map[int64]bool{}
|
||||
|
||||
mapData := testNativeOrderMap{}
|
||||
values := []Value{}
|
||||
|
||||
for len(values) < length {
|
||||
var entries []mapEntry
|
||||
for len(entries) < length {
|
||||
v := s.Int63() & 0xffffff
|
||||
if _, ok := used[v]; !ok {
|
||||
entry := mapEntry{Int64(v), Int64(v * 2)}
|
||||
mapData = append(mapData, entry)
|
||||
entry := mapEntry{gen(Int64(v)), gen(Int64(v * 2))}
|
||||
entries = append(entries, entry)
|
||||
used[v] = true
|
||||
values = append(values, entry.key, entry.value)
|
||||
}
|
||||
}
|
||||
|
||||
sort.Sort(mapData)
|
||||
return mapData, values
|
||||
return testMap{entries, less, MakeCompoundType(MapKind, tr, tr)}
|
||||
}
|
||||
|
||||
type testRefOrderMap []mapEntry
|
||||
|
||||
func (tm testRefOrderMap) Len() int {
|
||||
return len(tm)
|
||||
func getTestNativeOrderMap() testMap {
|
||||
return newTestMap(int(mapPattern*16), func(v Int64) Value {
|
||||
return v
|
||||
}, func(x, y Value) bool {
|
||||
return !y.(OrderedValue).Less(x.(OrderedValue))
|
||||
}, MakePrimitiveType(Int64Kind))
|
||||
}
|
||||
|
||||
func (tm testRefOrderMap) Less(i, j int) bool {
|
||||
return tm[i].key.Ref().Less(tm[j].key.Ref())
|
||||
func getTestRefValueOrderMap() testMap {
|
||||
setType := MakeCompoundType(SetKind, MakePrimitiveType(Int64Kind))
|
||||
return newTestMap(int(mapPattern*2), func(v Int64) Value {
|
||||
return NewTypedSet(chunks.NewMemoryStore(), setType, v)
|
||||
}, func(x, y Value) bool {
|
||||
return !y.Ref().Less(x.Ref())
|
||||
}, setType)
|
||||
}
|
||||
|
||||
func (tm testRefOrderMap) Swap(i, j int) {
|
||||
tm[i], tm[j] = tm[j], tm[i]
|
||||
func getTestRefToNativeOrderMap() testMap {
|
||||
refType := MakeCompoundType(RefKind, MakePrimitiveType(Int64Kind))
|
||||
return newTestMap(int(mapPattern*2), func(v Int64) Value {
|
||||
return newRef(v.Ref(), refType)
|
||||
}, func(x, y Value) bool {
|
||||
return !y.(RefBase).TargetRef().Less(x.(RefBase).TargetRef())
|
||||
}, refType)
|
||||
}
|
||||
|
||||
func getTestRefOrderMap() ([]mapEntry, []Value) {
|
||||
length := int(mapPattern * 16)
|
||||
s := rand.NewSource(42)
|
||||
used := map[int64]bool{}
|
||||
|
||||
values := []Value{}
|
||||
mapData := testRefOrderMap{}
|
||||
for i := 0; i < length; i++ {
|
||||
v := s.Int63() & 0xffffff
|
||||
if _, ok := used[v]; !ok {
|
||||
entry := mapEntry{NewRef(Int64(v).Ref()), Int64(v)}
|
||||
mapData = append(mapData, entry)
|
||||
used[v] = true
|
||||
values = append(values, entry.key, entry.value)
|
||||
}
|
||||
}
|
||||
|
||||
sort.Sort(mapData)
|
||||
return mapData, values
|
||||
func getTestRefToValueOrderMap() testMap {
|
||||
setType := MakeCompoundType(SetKind, MakePrimitiveType(Int64Kind))
|
||||
refType := MakeCompoundType(RefKind, setType)
|
||||
return newTestMap(int(mapPattern*2), func(v Int64) Value {
|
||||
return newRef(NewTypedSet(chunks.NewMemoryStore(), setType, v).Ref(), refType)
|
||||
}, func(x, y Value) bool {
|
||||
return !y.(RefBase).TargetRef().Less(x.(RefBase).TargetRef())
|
||||
}, refType)
|
||||
}
|
||||
|
||||
func TestCompoundMapHasAndGet(t *testing.T) {
|
||||
func TestCompoundMapHas(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
cs := chunks.NewMemoryStore()
|
||||
|
||||
doTest := func(simpleMap []mapEntry, m compoundMap) {
|
||||
for _, v := range simpleMap {
|
||||
assert.True(m.Has(v.key))
|
||||
assert.True(m.Get(v.key).Equals(v.value))
|
||||
doTest := func(tm testMap) {
|
||||
m := tm.toCompoundMap(chunks.NewMemoryStore())
|
||||
for _, entry := range tm.entries {
|
||||
assert.True(m.Has(entry.key))
|
||||
assert.True(m.Get(entry.key).Equals(entry.value))
|
||||
}
|
||||
}
|
||||
|
||||
simpleMap, kv := getTestNativeOrderMap()
|
||||
tr := MakeCompoundType(MapKind, MakePrimitiveType(Int64Kind), MakePrimitiveType(Int64Kind))
|
||||
m := NewTypedMap(cs, tr, kv...).(compoundMap)
|
||||
doTest(simpleMap, m)
|
||||
|
||||
simpleMap, kv = getTestRefOrderMap()
|
||||
tr = MakeCompoundType(MapKind, MakeCompoundType(RefKind, MakePrimitiveType(ValueKind)), MakePrimitiveType(Int64Kind))
|
||||
m = NewTypedMap(cs, tr, kv...).(compoundMap)
|
||||
doTest(simpleMap, m)
|
||||
doTest(getTestNativeOrderMap())
|
||||
doTest(getTestRefValueOrderMap())
|
||||
doTest(getTestRefToNativeOrderMap())
|
||||
doTest(getTestRefToValueOrderMap())
|
||||
}
|
||||
|
||||
func TestCompoundMapIter(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
cs := chunks.NewMemoryStore()
|
||||
|
||||
doTest := func(simpleMap []mapEntry, m compoundMap) {
|
||||
doTest := func(tm testMap) {
|
||||
m := tm.toCompoundMap(chunks.NewMemoryStore())
|
||||
sort.Sort(tm)
|
||||
idx := uint64(0)
|
||||
endAt := uint64(mapPattern)
|
||||
|
||||
m.Iter(func(k, v Value) bool {
|
||||
assert.True(simpleMap[idx].key.Equals(k))
|
||||
assert.True(simpleMap[idx].value.Equals(v))
|
||||
assert.True(tm.entries[idx].key.Equals(k))
|
||||
assert.True(tm.entries[idx].value.Equals(v))
|
||||
if idx == endAt {
|
||||
idx += 1
|
||||
return true
|
||||
}
|
||||
idx++
|
||||
|
||||
idx += 1
|
||||
return false
|
||||
})
|
||||
|
||||
assert.Equal(endAt, idx)
|
||||
assert.Equal(endAt, idx-1)
|
||||
}
|
||||
|
||||
simpleMap, kv := getTestNativeOrderMap()
|
||||
tr := MakeCompoundType(MapKind, MakePrimitiveType(Int64Kind), MakePrimitiveType(Int64Kind))
|
||||
m := NewTypedMap(cs, tr, kv...).(compoundMap)
|
||||
doTest(simpleMap, m)
|
||||
|
||||
simpleMap, kv = getTestRefOrderMap()
|
||||
tr = MakeCompoundType(MapKind, MakeCompoundType(RefKind, MakePrimitiveType(ValueKind)), MakePrimitiveType(Int64Kind))
|
||||
m = NewTypedMap(cs, tr, kv...).(compoundMap)
|
||||
doTest(simpleMap, m)
|
||||
doTest(getTestNativeOrderMap())
|
||||
doTest(getTestRefValueOrderMap())
|
||||
doTest(getTestRefToNativeOrderMap())
|
||||
doTest(getTestRefToValueOrderMap())
|
||||
}
|
||||
|
||||
func TestCompoundMapIterAll(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
cs := chunks.NewMemoryStore()
|
||||
|
||||
doTest := func(simpleMap []mapEntry, m compoundMap) {
|
||||
doTest := func(tm testMap) {
|
||||
m := tm.toCompoundMap(chunks.NewMemoryStore())
|
||||
sort.Sort(tm)
|
||||
idx := uint64(0)
|
||||
|
||||
m.IterAll(func(k, v Value) {
|
||||
assert.True(simpleMap[idx].key.Equals(k))
|
||||
assert.True(simpleMap[idx].value.Equals(v))
|
||||
assert.True(tm.entries[idx].key.Equals(k))
|
||||
assert.True(tm.entries[idx].value.Equals(v))
|
||||
idx++
|
||||
})
|
||||
}
|
||||
|
||||
simpleMap, kv := getTestNativeOrderMap()
|
||||
tr := MakeCompoundType(MapKind, MakePrimitiveType(Int64Kind), MakePrimitiveType(Int64Kind))
|
||||
m := NewTypedMap(cs, tr, kv...).(compoundMap)
|
||||
doTest(simpleMap, m)
|
||||
|
||||
simpleMap, kv = getTestRefOrderMap()
|
||||
tr = MakeCompoundType(MapKind, MakeCompoundType(RefKind, MakePrimitiveType(ValueKind)), MakePrimitiveType(Int64Kind))
|
||||
m = NewTypedMap(cs, tr, kv...).(compoundMap)
|
||||
doTest(simpleMap, m)
|
||||
doTest(getTestNativeOrderMap())
|
||||
doTest(getTestRefValueOrderMap())
|
||||
doTest(getTestRefToNativeOrderMap())
|
||||
doTest(getTestRefToValueOrderMap())
|
||||
}
|
||||
|
||||
@@ -9,103 +9,111 @@ import (
|
||||
"github.com/attic-labs/noms/chunks"
|
||||
)
|
||||
|
||||
type testNativeOrderSet []Value
|
||||
|
||||
func (tss testNativeOrderSet) Len() int {
|
||||
return len(tss)
|
||||
type testSet struct {
|
||||
values []Value
|
||||
less testSetLessFn
|
||||
tr Type
|
||||
}
|
||||
|
||||
func (tss testNativeOrderSet) Less(i, j int) bool {
|
||||
return tss[i].(OrderedValue).Less(tss[j].(OrderedValue))
|
||||
type testSetLessFn func(x, y Value) bool
|
||||
|
||||
func (ts testSet) Len() int {
|
||||
return len(ts.values)
|
||||
}
|
||||
|
||||
func (tss testNativeOrderSet) Swap(i, j int) {
|
||||
tss[i], tss[j] = tss[j], tss[i]
|
||||
func (ts testSet) Less(i, j int) bool {
|
||||
return ts.less(ts.values[i], ts.values[j])
|
||||
}
|
||||
|
||||
func getTestNativeOrderSet() []Value {
|
||||
length := int(setPattern * 16)
|
||||
s := rand.NewSource(42)
|
||||
func (ts testSet) Swap(i, j int) {
|
||||
ts.values[i], ts.values[j] = ts.values[j], ts.values[i]
|
||||
}
|
||||
|
||||
func (ts testSet) toCompoundSet(cs chunks.ChunkStore) compoundSet {
|
||||
return NewTypedSet(cs, ts.tr, ts.values...).(compoundSet)
|
||||
}
|
||||
|
||||
type testSetGenFn func(v Int64) Value
|
||||
|
||||
func newTestSet(length int, gen testSetGenFn, less testSetLessFn, tr Type) testSet {
|
||||
s := rand.NewSource(4242)
|
||||
used := map[int64]bool{}
|
||||
|
||||
values := testNativeOrderSet{}
|
||||
var values []Value
|
||||
for len(values) < length {
|
||||
v := s.Int63() & 0xffffff
|
||||
if _, ok := used[v]; !ok {
|
||||
values = append(values, Int64(v))
|
||||
values = append(values, gen(Int64(v)))
|
||||
used[v] = true
|
||||
}
|
||||
}
|
||||
|
||||
sort.Sort(values)
|
||||
return values
|
||||
return testSet{values, less, MakeCompoundType(SetKind, tr)}
|
||||
}
|
||||
|
||||
type testRefOrderSet []Value
|
||||
|
||||
func (tss testRefOrderSet) Len() int {
|
||||
return len(tss)
|
||||
func getTestNativeOrderSet() testSet {
|
||||
return newTestSet(int(setPattern*16), func(v Int64) Value {
|
||||
return v
|
||||
}, func(x, y Value) bool {
|
||||
return !y.(OrderedValue).Less(x.(OrderedValue))
|
||||
}, MakePrimitiveType(Int64Kind))
|
||||
}
|
||||
|
||||
func (tss testRefOrderSet) Less(i, j int) bool {
|
||||
return tss[i].Ref().Less(tss[j].Ref())
|
||||
func getTestRefValueOrderSet() testSet {
|
||||
setType := MakeCompoundType(SetKind, MakePrimitiveType(Int64Kind))
|
||||
return newTestSet(int(setPattern*2), func(v Int64) Value {
|
||||
return NewTypedSet(chunks.NewMemoryStore(), setType, v)
|
||||
}, func(x, y Value) bool {
|
||||
return !y.Ref().Less(x.Ref())
|
||||
}, setType)
|
||||
}
|
||||
|
||||
func (tss testRefOrderSet) Swap(i, j int) {
|
||||
tss[i], tss[j] = tss[j], tss[i]
|
||||
func getTestRefToNativeOrderSet() testSet {
|
||||
refType := MakeCompoundType(RefKind, MakePrimitiveType(Int64Kind))
|
||||
return newTestSet(int(setPattern*2), func(v Int64) Value {
|
||||
return newRef(v.Ref(), refType)
|
||||
}, func(x, y Value) bool {
|
||||
return !y.(RefBase).TargetRef().Less(x.(RefBase).TargetRef())
|
||||
}, refType)
|
||||
}
|
||||
|
||||
func getTestRefOrderSet() []Value {
|
||||
length := int(setPattern * 2)
|
||||
s := rand.NewSource(42)
|
||||
used := map[int64]bool{}
|
||||
|
||||
values := testRefOrderSet{}
|
||||
for i := 0; i < length; i++ {
|
||||
v := s.Int63() & 0xffffff
|
||||
if _, ok := used[v]; !ok {
|
||||
values = append(values, NewRef(Int64(v).Ref()))
|
||||
used[v] = true
|
||||
}
|
||||
}
|
||||
|
||||
sort.Sort(values)
|
||||
return values
|
||||
func getTestRefToValueOrderSet() testSet {
|
||||
setType := MakeCompoundType(SetKind, MakePrimitiveType(Int64Kind))
|
||||
refType := MakeCompoundType(RefKind, setType)
|
||||
return newTestSet(int(setPattern*2), func(v Int64) Value {
|
||||
return newRef(NewTypedSet(chunks.NewMemoryStore(), setType, v).Ref(), refType)
|
||||
}, func(x, y Value) bool {
|
||||
return !y.(RefBase).TargetRef().Less(x.(RefBase).TargetRef())
|
||||
}, refType)
|
||||
}
|
||||
|
||||
func TestCompoundSetHas(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
cs := chunks.NewMemoryStore()
|
||||
|
||||
doTest := func(simpleSet []Value, set compoundSet) {
|
||||
for _, v := range simpleSet {
|
||||
doTest := func(ts testSet) {
|
||||
set := ts.toCompoundSet(chunks.NewMemoryStore())
|
||||
for _, v := range ts.values {
|
||||
assert.True(set.Has(v))
|
||||
}
|
||||
}
|
||||
|
||||
simpleSet := getTestNativeOrderSet()
|
||||
tr := MakeCompoundType(SetKind, MakePrimitiveType(Int64Kind))
|
||||
set := NewTypedSet(cs, tr, simpleSet...).(compoundSet)
|
||||
doTest(simpleSet, set)
|
||||
|
||||
simpleSet = getTestRefOrderSet()
|
||||
tr = MakeCompoundType(SetKind, MakeCompoundType(RefKind, MakePrimitiveType(ValueKind)))
|
||||
set = NewTypedSet(cs, tr, simpleSet...).(compoundSet)
|
||||
doTest(simpleSet, set)
|
||||
doTest(getTestNativeOrderSet())
|
||||
doTest(getTestRefValueOrderSet())
|
||||
doTest(getTestRefToNativeOrderSet())
|
||||
doTest(getTestRefToValueOrderSet())
|
||||
}
|
||||
|
||||
func TestCompoundSetIter(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
cs := chunks.NewMemoryStore()
|
||||
|
||||
doTest := func(simpleSet []Value, set compoundSet) {
|
||||
doTest := func(ts testSet) {
|
||||
set := ts.toCompoundSet(chunks.NewMemoryStore())
|
||||
sort.Sort(ts)
|
||||
idx := uint64(0)
|
||||
endAt := uint64(setPattern)
|
||||
|
||||
set.Iter(func(v Value) bool {
|
||||
assert.True(simpleSet[idx].Equals(v))
|
||||
assert.True(ts.values[idx].Equals(v))
|
||||
if idx == endAt {
|
||||
idx += 1
|
||||
return true
|
||||
@@ -118,40 +126,28 @@ func TestCompoundSetIter(t *testing.T) {
|
||||
assert.Equal(endAt, idx-1)
|
||||
}
|
||||
|
||||
simpleSet := getTestNativeOrderSet()
|
||||
tr := MakeCompoundType(SetKind, MakePrimitiveType(Int64Kind))
|
||||
set := NewTypedSet(cs, tr, simpleSet...).(compoundSet)
|
||||
doTest(simpleSet, set)
|
||||
|
||||
simpleSet = getTestRefOrderSet()
|
||||
tr = MakeCompoundType(SetKind, MakeCompoundType(RefKind, MakePrimitiveType(ValueKind)))
|
||||
set = NewTypedSet(cs, tr, simpleSet...).(compoundSet)
|
||||
doTest(simpleSet, set)
|
||||
doTest(getTestNativeOrderSet())
|
||||
doTest(getTestRefValueOrderSet())
|
||||
doTest(getTestRefToNativeOrderSet())
|
||||
doTest(getTestRefToValueOrderSet())
|
||||
}
|
||||
|
||||
func TestCompoundSetIterAll(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("Skipping test in short mode.")
|
||||
}
|
||||
assert := assert.New(t)
|
||||
|
||||
cs := chunks.NewMemoryStore()
|
||||
|
||||
doTest := func(simpleSet []Value, set compoundSet) {
|
||||
doTest := func(ts testSet) {
|
||||
set := ts.toCompoundSet(chunks.NewMemoryStore())
|
||||
sort.Sort(ts)
|
||||
idx := uint64(0)
|
||||
|
||||
set.IterAll(func(v Value) {
|
||||
assert.True(simpleSet[idx].Equals(v))
|
||||
assert.True(ts.values[idx].Equals(v))
|
||||
idx++
|
||||
})
|
||||
}
|
||||
|
||||
simpleSet := getTestNativeOrderSet()
|
||||
tr := MakeCompoundType(SetKind, MakePrimitiveType(Int64Kind))
|
||||
set := NewTypedSet(cs, tr, simpleSet...).(compoundSet)
|
||||
doTest(simpleSet, set)
|
||||
|
||||
simpleSet = getTestRefOrderSet()
|
||||
tr = MakeCompoundType(SetKind, MakeCompoundType(RefKind, MakePrimitiveType(ValueKind)))
|
||||
set = NewTypedSet(cs, tr, simpleSet...).(compoundSet)
|
||||
doTest(simpleSet, set)
|
||||
doTest(getTestNativeOrderSet())
|
||||
doTest(getTestRefValueOrderSet())
|
||||
doTest(getTestRefToNativeOrderSet())
|
||||
doTest(getTestRefToValueOrderSet())
|
||||
}
|
||||
|
||||
@@ -197,6 +197,10 @@ func (m RefOfPackage) Type() Type {
|
||||
return __typeForRefOfPackage
|
||||
}
|
||||
|
||||
func (r RefOfPackage) Less(other OrderedValue) bool {
|
||||
return r.TargetRef().Less(other.(RefBase).TargetRef())
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForRefOfPackage = MakeCompoundType(RefKind, MakePrimitiveType(PackageKind))
|
||||
RegisterRef(__typeForRefOfPackage, builderForRefOfPackage)
|
||||
|
||||
@@ -49,6 +49,10 @@ func (r Ref) Type() Type {
|
||||
return r.t
|
||||
}
|
||||
|
||||
func (r Ref) Less(other OrderedValue) bool {
|
||||
return r.target.Less(other.(Ref).target)
|
||||
}
|
||||
|
||||
func (r Ref) TargetValue(cs chunks.ChunkStore) Value {
|
||||
return ReadValue(r.target, cs)
|
||||
}
|
||||
|
||||
@@ -69,10 +69,12 @@ func (t Type) Kind() NomsKind {
|
||||
}
|
||||
|
||||
func (t Type) IsOrdered() bool {
|
||||
if desc, ok := t.Desc.(PrimitiveDesc); ok {
|
||||
return desc.IsOrdered()
|
||||
switch t.Desc.Kind() {
|
||||
case Float32Kind, Float64Kind, Int8Kind, Int16Kind, Int32Kind, Int64Kind, Uint8Kind, Uint16Kind, Uint32Kind, Uint64Kind, StringKind, RefKind:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (t Type) PackageRef() ref.Ref {
|
||||
|
||||
@@ -46,15 +46,6 @@ func (p PrimitiveDesc) Describe() string {
|
||||
return KindToString[p.Kind()]
|
||||
}
|
||||
|
||||
func (p PrimitiveDesc) IsOrdered() bool {
|
||||
switch p.Kind() {
|
||||
case Float32Kind, Float64Kind, Int8Kind, Int16Kind, Int32Kind, Int64Kind, Uint8Kind, Uint16Kind, Uint32Kind, Uint64Kind, StringKind:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
var KindToString = map[NomsKind]string{
|
||||
BlobKind: "Blob",
|
||||
BoolKind: "Bool",
|
||||
|
||||
@@ -110,5 +110,5 @@ func TestTypeOrdered(t *testing.T) {
|
||||
assert.False(MakeCompoundType(ListKind, MakePrimitiveType(StringKind)).IsOrdered())
|
||||
assert.False(MakeCompoundType(SetKind, MakePrimitiveType(StringKind)).IsOrdered())
|
||||
assert.False(MakeCompoundType(MapKind, MakePrimitiveType(StringKind), MakePrimitiveType(ValueKind)).IsOrdered())
|
||||
assert.False(MakeCompoundType(RefKind, MakePrimitiveType(StringKind)).IsOrdered())
|
||||
assert.True(MakeCompoundType(RefKind, MakePrimitiveType(StringKind)).IsOrdered())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user