mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-12 19:39:32 -05:00
@@ -14,4 +14,4 @@ struct Incident {
|
||||
PdID: String
|
||||
}
|
||||
|
||||
using List(Ref(Incident))
|
||||
using List<Ref<Incident>>
|
||||
|
||||
@@ -5,8 +5,8 @@ struct RemotePhoto {
|
||||
Title: String
|
||||
Url: String
|
||||
Geoposition: Geo.Geoposition
|
||||
Sizes: Map(Size, String)
|
||||
Tags: Set(String)
|
||||
Sizes: Map<Size, String>
|
||||
Tags: Set<String>
|
||||
}
|
||||
|
||||
struct Size {
|
||||
@@ -14,5 +14,5 @@ struct Size {
|
||||
Height: Uint32
|
||||
}
|
||||
|
||||
using Map(Size, String)
|
||||
using Set(String)
|
||||
using Map<Size, String>
|
||||
using Set<String>
|
||||
|
||||
@@ -2,12 +2,12 @@ alias Geo = import "geo.noms"
|
||||
|
||||
struct Node {
|
||||
Geoposition: Geo.Geoposition
|
||||
Reference: Ref(Value)
|
||||
Reference: Ref<Value>
|
||||
}
|
||||
|
||||
struct QuadTree {
|
||||
Nodes: List(Node)
|
||||
Tiles: Map(String, QuadTree)
|
||||
Nodes: List<Node>
|
||||
Tiles: Map<String, QuadTree>
|
||||
Depth: Uint8
|
||||
NumDescendents: Uint32
|
||||
Path: String
|
||||
@@ -15,8 +15,8 @@ struct QuadTree {
|
||||
}
|
||||
|
||||
struct SQuadTree {
|
||||
Nodes: List(Ref(Value))
|
||||
Tiles: Map(String, Ref(SQuadTree))
|
||||
Nodes: List<Ref<Value>>
|
||||
Tiles: Map<String, Ref<SQuadTree>>
|
||||
Depth: Uint8
|
||||
NumDescendents: Uint32
|
||||
Path: String
|
||||
|
||||
@@ -2,7 +2,7 @@ struct Company {
|
||||
Permalink: String
|
||||
Name: String
|
||||
HomepageUrl: String
|
||||
CategoryList: Set(String)
|
||||
CategoryList: Set<String>
|
||||
Market: String
|
||||
FundingTotalUsd: Float64
|
||||
Status: String
|
||||
@@ -14,7 +14,7 @@ struct Company {
|
||||
FoundedAt: Int64
|
||||
FirstFundingAt: Int64
|
||||
LastFundingAt: Int64
|
||||
Rounds: Set(Ref(Round))
|
||||
Rounds: Set<Ref<Round>>
|
||||
}
|
||||
|
||||
struct Round {
|
||||
|
||||
@@ -3,7 +3,7 @@ alias cb = import "../crunchbase.noms"
|
||||
struct Import {
|
||||
FileSHA1: String
|
||||
Date: Date
|
||||
Companies: Ref(Map(String, Ref(cb.Company)))
|
||||
Companies: Ref<Map<String, Ref<cb.Company>>>
|
||||
}
|
||||
|
||||
struct Date {
|
||||
|
||||
@@ -38,9 +38,9 @@ enum RoundTypeEnum {
|
||||
|
||||
struct RoundRaise {
|
||||
Raised: Float64
|
||||
Details: Ref(cb.Round)
|
||||
Details: Ref<cb.Round>
|
||||
}
|
||||
|
||||
using Map(String, Ref(cb.Company))
|
||||
using Map(Ref(Key), Set(RoundRaise))
|
||||
using Map(Ref(Key), Ref(Set(RoundRaise)))
|
||||
using Map<String, Ref<cb.Company>>
|
||||
using Map<Ref<Key>, Set<RoundRaise>>
|
||||
using Map<Ref<Key>, Ref<Set<RoundRaise>>>
|
||||
|
||||
@@ -42,8 +42,8 @@ func init() {
|
||||
types.Choices{},
|
||||
),
|
||||
}, []ref.Ref{
|
||||
ref.Parse("sha1-e28aa19ad63c4ddabeb258aafe9b2b97fadd3666"),
|
||||
ref.Parse("sha1-3e4f60c3fbd518f4a7e903ac1c7c1a97b677c4d9"),
|
||||
ref.Parse("sha1-e28aa19ad63c4ddabeb258aafe9b2b97fadd3666"),
|
||||
})
|
||||
__mainPackageInFile_index_CachedRef = types.RegisterPackage(&p)
|
||||
}
|
||||
|
||||
@@ -5,14 +5,14 @@ struct User {
|
||||
Name: String
|
||||
OAuthToken: String
|
||||
OAuthSecret: String
|
||||
Albums: Map(String, Album)
|
||||
Albums: Map<String, Album>
|
||||
}
|
||||
|
||||
struct Album {
|
||||
Id: String
|
||||
Title: String
|
||||
Photos: Ref(Set(Ref(Img.RemotePhoto)))
|
||||
Photos: Ref<Set<Ref<Img.RemotePhoto>>>
|
||||
}
|
||||
|
||||
using Map(String, Album)
|
||||
using Ref(User)
|
||||
using Map<String, Album>
|
||||
using Ref<User>
|
||||
|
||||
@@ -6,4 +6,4 @@ struct Song {
|
||||
Mp3: Blob
|
||||
}
|
||||
|
||||
using List(Song)
|
||||
using List<Song>
|
||||
|
||||
@@ -3,7 +3,7 @@ alias Img = import "../common/photo.noms"
|
||||
struct User {
|
||||
Id: String
|
||||
Name: String
|
||||
Albums: Map(String, Album)
|
||||
Albums: Map<String, Album>
|
||||
RefreshToken: String
|
||||
OAuthToken: String
|
||||
OAuthSecret: String
|
||||
@@ -13,9 +13,9 @@ struct Album {
|
||||
Id: String
|
||||
Title: String
|
||||
NumPhotos: Uint32
|
||||
Photos: Ref(Set(Ref(Img.RemotePhoto)))
|
||||
Photos: Ref<Set<Ref<Img.RemotePhoto>>>
|
||||
}
|
||||
|
||||
using Map(String, Album)
|
||||
using Set(Img.RemotePhoto)
|
||||
using Ref(User)
|
||||
using Map<String, Album>
|
||||
using Set<Img.RemotePhoto>
|
||||
using Ref<User>
|
||||
|
||||
@@ -3,8 +3,8 @@ struct Pitch {
|
||||
Z: Float64
|
||||
}
|
||||
|
||||
using Map(String, Ref(List(Pitch)))
|
||||
using List(Ref(Map(String, Value)))
|
||||
using Ref(Map(String, Value))
|
||||
using Map(String, Value)
|
||||
using List(Pitch)
|
||||
using Map<String, Ref<List<Pitch>>>
|
||||
using List<Ref<Map<String, Value>>>
|
||||
using Ref<Map<String, Value>>
|
||||
using Map<String, Value>
|
||||
using List<Pitch>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
alias Photo = import "../common/photo.noms"
|
||||
|
||||
using Map(String, Set(Ref(Photo.RemotePhoto)))
|
||||
using Set(Ref(Photo.RemotePhoto))
|
||||
using Set(String)
|
||||
using Map<String, Set<Ref<Photo.RemotePhoto>>>
|
||||
using Set<Ref<Photo.RemotePhoto>>
|
||||
using Set<String>
|
||||
|
||||
@@ -1 +1 @@
|
||||
using List(Ref(Map(String, Value)))
|
||||
using List<Ref<Map<String, Value>>>
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
struct Commit {
|
||||
value: Value
|
||||
parents: Set(Ref(Commit))
|
||||
parents: Set<Ref<Commit>>
|
||||
}
|
||||
|
||||
using Map(String, Ref(Commit))
|
||||
using Map<String, Ref<Commit>>
|
||||
|
||||
@@ -79,64 +79,64 @@ func TestCanUseDef(t *testing.T) {
|
||||
}
|
||||
|
||||
good := `
|
||||
using List(Int8)
|
||||
using Set(Int8)
|
||||
using Map(Int8, Int8)
|
||||
using Map(Int8, Set(Int8))
|
||||
using Map(Int8, Map(Int8, Int8))
|
||||
using List<Int8>
|
||||
using Set<Int8>
|
||||
using Map<Int8, Int8>
|
||||
using Map<Int8, Set<Int8>>
|
||||
using Map<Int8, Map<Int8, Int8>>
|
||||
|
||||
struct Simple {
|
||||
x: Int8
|
||||
}
|
||||
using Set(Simple)
|
||||
using Map(Simple, Int8)
|
||||
using Map(Simple, Simple)
|
||||
using Set<Simple>
|
||||
using Map<Simple, Int8>
|
||||
using Map<Simple, Simple>
|
||||
`
|
||||
assertCanUseDef(good, true, true)
|
||||
|
||||
good = `
|
||||
struct Tree {
|
||||
children: List(Tree)
|
||||
children: List<Tree>
|
||||
}
|
||||
`
|
||||
assertCanUseDef(good, true, true)
|
||||
|
||||
bad := `
|
||||
struct WithList {
|
||||
x: List(Int8)
|
||||
x: List<Int8>
|
||||
}
|
||||
using Set(WithList)
|
||||
using Map(WithList, Int8)
|
||||
using Set<WithList>
|
||||
using Map<WithList, Int8>
|
||||
|
||||
struct WithSet {
|
||||
x: Set(Int8)
|
||||
x: Set<Int8>
|
||||
}
|
||||
using Set(WithSet)
|
||||
using Map(WithSet, Int8)
|
||||
using Set<WithSet>
|
||||
using Map<WithSet, Int8>
|
||||
|
||||
struct WithMap {
|
||||
x: Map(Int8, Int8)
|
||||
x: Map<Int8, Int8>
|
||||
}
|
||||
using Set(WithMap)
|
||||
using Map(WithMap, Int8)
|
||||
using Set<WithMap>
|
||||
using Map<WithMap, Int8>
|
||||
`
|
||||
assertCanUseDef(bad, false, true)
|
||||
|
||||
bad = `
|
||||
struct Commit {
|
||||
value: Value
|
||||
parents: Set(Commit)
|
||||
parents: Set<Commit>
|
||||
}
|
||||
`
|
||||
assertCanUseDef(bad, false, false)
|
||||
|
||||
bad = `
|
||||
Set(Set(Int8))
|
||||
Set(Map(Int8, Int8))
|
||||
Set(List(Int8))
|
||||
Map(Set(Int8), Int8)
|
||||
Map(Map(Int8, Int8), Int8)
|
||||
Map(List(Int8), Int8)
|
||||
Set<Set<Int8>>
|
||||
Set<Map<Int8, Int8>>
|
||||
Set<List<Int8>>
|
||||
Map<Set<Int8>, Int8>
|
||||
Map<Map<Int8, Int8>, Int8>
|
||||
Map<List<Int8>, Int8>
|
||||
`
|
||||
|
||||
for _, line := range strings.Split(bad, "\n") {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
struct A {
|
||||
A: List(List(Blob))
|
||||
A: List<List<Blob>>
|
||||
}
|
||||
|
||||
@@ -114,146 +114,3 @@ func (s StructWithDupList) SetL(val ListOfUint8) StructWithDupList {
|
||||
s.ref = &ref.Ref{}
|
||||
return s
|
||||
}
|
||||
|
||||
// ListOfUint8
|
||||
|
||||
type ListOfUint8 struct {
|
||||
l types.List
|
||||
cs chunks.ChunkStore
|
||||
ref *ref.Ref
|
||||
}
|
||||
|
||||
func NewListOfUint8(cs chunks.ChunkStore) ListOfUint8 {
|
||||
return ListOfUint8{types.NewTypedList(cs, __typeForListOfUint8), cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
type ListOfUint8Def []uint8
|
||||
|
||||
func (def ListOfUint8Def) New(cs chunks.ChunkStore) ListOfUint8 {
|
||||
l := make([]types.Value, len(def))
|
||||
for i, d := range def {
|
||||
l[i] = types.Uint8(d)
|
||||
}
|
||||
return ListOfUint8{types.NewTypedList(cs, __typeForListOfUint8, l...), cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Def() ListOfUint8Def {
|
||||
d := make([]uint8, l.Len())
|
||||
for i := uint64(0); i < l.Len(); i++ {
|
||||
d[i] = uint8(l.l.Get(i).(types.Uint8))
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Equals(other types.Value) bool {
|
||||
return other != nil && __typeForListOfUint8.Equals(other.Type()) && l.Ref() == other.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Ref() ref.Ref {
|
||||
return types.EnsureRef(l.ref, l)
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Chunks() (chunks []ref.Ref) {
|
||||
chunks = append(chunks, l.Type().Chunks()...)
|
||||
chunks = append(chunks, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (l ListOfUint8) ChildValues() []types.Value {
|
||||
return append([]types.Value{}, l.l.ChildValues()...)
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfUint8.
|
||||
var __typeForListOfUint8 types.Type
|
||||
|
||||
func (m ListOfUint8) Type() types.Type {
|
||||
return __typeForListOfUint8
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForListOfUint8 = types.MakeCompoundType(types.ListKind, types.MakePrimitiveType(types.Uint8Kind))
|
||||
types.RegisterValue(__typeForListOfUint8, builderForListOfUint8, readerForListOfUint8)
|
||||
}
|
||||
|
||||
func builderForListOfUint8(cs chunks.ChunkStore, v types.Value) types.Value {
|
||||
return ListOfUint8{v.(types.List), cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func readerForListOfUint8(v types.Value) types.Value {
|
||||
return v.(ListOfUint8).l
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Len() uint64 {
|
||||
return l.l.Len()
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Empty() bool {
|
||||
return l.Len() == uint64(0)
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Get(i uint64) uint8 {
|
||||
return uint8(l.l.Get(i).(types.Uint8))
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Slice(idx uint64, end uint64) ListOfUint8 {
|
||||
return ListOfUint8{l.l.Slice(idx, end), l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Set(i uint64, val uint8) ListOfUint8 {
|
||||
return ListOfUint8{l.l.Set(i, types.Uint8(val)), l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Append(v ...uint8) ListOfUint8 {
|
||||
return ListOfUint8{l.l.Append(l.fromElemSlice(v)...), l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Insert(idx uint64, v ...uint8) ListOfUint8 {
|
||||
return ListOfUint8{l.l.Insert(idx, l.fromElemSlice(v)...), l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Remove(idx uint64, end uint64) ListOfUint8 {
|
||||
return ListOfUint8{l.l.Remove(idx, end), l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) RemoveAt(idx uint64) ListOfUint8 {
|
||||
return ListOfUint8{(l.l.RemoveAt(idx)), l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) fromElemSlice(p []uint8) []types.Value {
|
||||
r := make([]types.Value, len(p))
|
||||
for i, v := range p {
|
||||
r[i] = types.Uint8(v)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
type ListOfUint8IterCallback func(v uint8, i uint64) (stop bool)
|
||||
|
||||
func (l ListOfUint8) Iter(cb ListOfUint8IterCallback) {
|
||||
l.l.Iter(func(v types.Value, i uint64) bool {
|
||||
return cb(uint8(v.(types.Uint8)), i)
|
||||
})
|
||||
}
|
||||
|
||||
type ListOfUint8IterAllCallback func(v uint8, i uint64)
|
||||
|
||||
func (l ListOfUint8) IterAll(cb ListOfUint8IterAllCallback) {
|
||||
l.l.IterAll(func(v types.Value, i uint64) {
|
||||
cb(uint8(v.(types.Uint8)), i)
|
||||
})
|
||||
}
|
||||
|
||||
func (l ListOfUint8) IterAllP(concurrency int, cb ListOfUint8IterAllCallback) {
|
||||
l.l.IterAllP(concurrency, func(v types.Value, i uint64) {
|
||||
cb(uint8(v.(types.Uint8)), i)
|
||||
})
|
||||
}
|
||||
|
||||
type ListOfUint8FilterCallback func(v uint8, i uint64) (keep bool)
|
||||
|
||||
func (l ListOfUint8) Filter(cb ListOfUint8FilterCallback) ListOfUint8 {
|
||||
out := l.l.Filter(func(v types.Value, i uint64) bool {
|
||||
return cb(uint8(v.(types.Uint8)), i)
|
||||
})
|
||||
return ListOfUint8{out, l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
@@ -174,3 +174,146 @@ func (s StructWithList) SetI(val int64) StructWithList {
|
||||
s.ref = &ref.Ref{}
|
||||
return s
|
||||
}
|
||||
|
||||
// ListOfUint8
|
||||
|
||||
type ListOfUint8 struct {
|
||||
l types.List
|
||||
cs chunks.ChunkStore
|
||||
ref *ref.Ref
|
||||
}
|
||||
|
||||
func NewListOfUint8(cs chunks.ChunkStore) ListOfUint8 {
|
||||
return ListOfUint8{types.NewTypedList(cs, __typeForListOfUint8), cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
type ListOfUint8Def []uint8
|
||||
|
||||
func (def ListOfUint8Def) New(cs chunks.ChunkStore) ListOfUint8 {
|
||||
l := make([]types.Value, len(def))
|
||||
for i, d := range def {
|
||||
l[i] = types.Uint8(d)
|
||||
}
|
||||
return ListOfUint8{types.NewTypedList(cs, __typeForListOfUint8, l...), cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Def() ListOfUint8Def {
|
||||
d := make([]uint8, l.Len())
|
||||
for i := uint64(0); i < l.Len(); i++ {
|
||||
d[i] = uint8(l.l.Get(i).(types.Uint8))
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Equals(other types.Value) bool {
|
||||
return other != nil && __typeForListOfUint8.Equals(other.Type()) && l.Ref() == other.Ref()
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Ref() ref.Ref {
|
||||
return types.EnsureRef(l.ref, l)
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Chunks() (chunks []ref.Ref) {
|
||||
chunks = append(chunks, l.Type().Chunks()...)
|
||||
chunks = append(chunks, l.l.Chunks()...)
|
||||
return
|
||||
}
|
||||
|
||||
func (l ListOfUint8) ChildValues() []types.Value {
|
||||
return append([]types.Value{}, l.l.ChildValues()...)
|
||||
}
|
||||
|
||||
// A Noms Value that describes ListOfUint8.
|
||||
var __typeForListOfUint8 types.Type
|
||||
|
||||
func (m ListOfUint8) Type() types.Type {
|
||||
return __typeForListOfUint8
|
||||
}
|
||||
|
||||
func init() {
|
||||
__typeForListOfUint8 = types.MakeCompoundType(types.ListKind, types.MakePrimitiveType(types.Uint8Kind))
|
||||
types.RegisterValue(__typeForListOfUint8, builderForListOfUint8, readerForListOfUint8)
|
||||
}
|
||||
|
||||
func builderForListOfUint8(cs chunks.ChunkStore, v types.Value) types.Value {
|
||||
return ListOfUint8{v.(types.List), cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func readerForListOfUint8(v types.Value) types.Value {
|
||||
return v.(ListOfUint8).l
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Len() uint64 {
|
||||
return l.l.Len()
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Empty() bool {
|
||||
return l.Len() == uint64(0)
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Get(i uint64) uint8 {
|
||||
return uint8(l.l.Get(i).(types.Uint8))
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Slice(idx uint64, end uint64) ListOfUint8 {
|
||||
return ListOfUint8{l.l.Slice(idx, end), l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Set(i uint64, val uint8) ListOfUint8 {
|
||||
return ListOfUint8{l.l.Set(i, types.Uint8(val)), l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Append(v ...uint8) ListOfUint8 {
|
||||
return ListOfUint8{l.l.Append(l.fromElemSlice(v)...), l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Insert(idx uint64, v ...uint8) ListOfUint8 {
|
||||
return ListOfUint8{l.l.Insert(idx, l.fromElemSlice(v)...), l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) Remove(idx uint64, end uint64) ListOfUint8 {
|
||||
return ListOfUint8{l.l.Remove(idx, end), l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) RemoveAt(idx uint64) ListOfUint8 {
|
||||
return ListOfUint8{(l.l.RemoveAt(idx)), l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
func (l ListOfUint8) fromElemSlice(p []uint8) []types.Value {
|
||||
r := make([]types.Value, len(p))
|
||||
for i, v := range p {
|
||||
r[i] = types.Uint8(v)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
type ListOfUint8IterCallback func(v uint8, i uint64) (stop bool)
|
||||
|
||||
func (l ListOfUint8) Iter(cb ListOfUint8IterCallback) {
|
||||
l.l.Iter(func(v types.Value, i uint64) bool {
|
||||
return cb(uint8(v.(types.Uint8)), i)
|
||||
})
|
||||
}
|
||||
|
||||
type ListOfUint8IterAllCallback func(v uint8, i uint64)
|
||||
|
||||
func (l ListOfUint8) IterAll(cb ListOfUint8IterAllCallback) {
|
||||
l.l.IterAll(func(v types.Value, i uint64) {
|
||||
cb(uint8(v.(types.Uint8)), i)
|
||||
})
|
||||
}
|
||||
|
||||
func (l ListOfUint8) IterAllP(concurrency int, cb ListOfUint8IterAllCallback) {
|
||||
l.l.IterAllP(concurrency, func(v types.Value, i uint64) {
|
||||
cb(uint8(v.(types.Uint8)), i)
|
||||
})
|
||||
}
|
||||
|
||||
type ListOfUint8FilterCallback func(v uint8, i uint64) (keep bool)
|
||||
|
||||
func (l ListOfUint8) Filter(cb ListOfUint8FilterCallback) ListOfUint8 {
|
||||
out := l.l.Filter(func(v types.Value, i uint64) bool {
|
||||
return cb(uint8(v.(types.Uint8)), i)
|
||||
})
|
||||
return ListOfUint8{out, l.cs, &ref.Ref{}}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
using List(Int64)
|
||||
using List<Int64>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
using Map(Bool, String)
|
||||
using Map(String, Value)
|
||||
using Map<Bool, String>
|
||||
using Map<String, Value>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Ref(List(String))
|
||||
using List(Ref(Float32))
|
||||
using Ref<List<String>>
|
||||
using List<Ref<Float32>>
|
||||
|
||||
struct StructWithRef {
|
||||
r: Ref(Set(Float32))
|
||||
r: Ref<Set<Float32>>
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
using Set(Bool)
|
||||
using Set<Bool>
|
||||
|
||||
@@ -3,4 +3,4 @@ struct Struct {
|
||||
b: Bool
|
||||
}
|
||||
|
||||
using List(Struct)
|
||||
using List<Struct>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
struct Tree {
|
||||
children: List(Tree)
|
||||
children: List<Tree>
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
struct StructWithDupList {
|
||||
l: List(Uint8)
|
||||
l: List<Uint8>
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ struct ImportUser {
|
||||
enum :LocalE
|
||||
}
|
||||
|
||||
using List(dep.D)
|
||||
using List<dep.D>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
struct StructWithList {
|
||||
l: List(Uint8)
|
||||
l: List<Uint8>
|
||||
b: Bool
|
||||
s: String
|
||||
i: Int64
|
||||
|
||||
@@ -5,6 +5,6 @@ struct StructWithUnionField {
|
||||
c: String
|
||||
d: Blob
|
||||
e: Value
|
||||
f: Set(Uint8)
|
||||
f: Set<Uint8>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,13 +149,13 @@ Type <- t:(PrimitiveType / CompoundType / Union / NamespaceIdent) {
|
||||
}
|
||||
}
|
||||
|
||||
CompoundType <- `List` _ `(` _ t:Type _ `)` _ {
|
||||
CompoundType <- `List` _ `<` _ t:Type _ `>` _ {
|
||||
return types.MakeCompoundType(types.ListKind, t.(types.Type)), nil
|
||||
} / `Map` _ `(` _ k:Type _ `,` _ v:Type _ `)` _ {
|
||||
} / `Map` _ `<` _ k:Type _ `,` _ v:Type _ `>` _ {
|
||||
return types.MakeCompoundType(types.MapKind, k.(types.Type), v.(types.Type)), nil
|
||||
} / `Set` _ `(` _ t:Type _ `)` _ {
|
||||
} / `Set` _ `<` _ t:Type _ `>` _ {
|
||||
return types.MakeCompoundType(types.SetKind, t.(types.Type)), nil
|
||||
} / `Ref` _ `(` _ t:Type _ `)` _ {
|
||||
} / `Ref` _ `<` _ t:Type _ `>` _ {
|
||||
return types.MakeCompoundType(types.RefKind, t.(types.Type)), nil
|
||||
}
|
||||
|
||||
|
||||
@@ -585,7 +585,7 @@ var g = &grammar{
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 152, col: 26, offset: 3779},
|
||||
val: "(",
|
||||
val: "<",
|
||||
ignoreCase: false,
|
||||
},
|
||||
&ruleRefExpr{
|
||||
@@ -606,7 +606,7 @@ var g = &grammar{
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 152, col: 41, offset: 3794},
|
||||
val: ")",
|
||||
val: ">",
|
||||
ignoreCase: false,
|
||||
},
|
||||
&ruleRefExpr{
|
||||
@@ -633,7 +633,7 @@ var g = &grammar{
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 154, col: 13, offset: 3882},
|
||||
val: "(",
|
||||
val: "<",
|
||||
ignoreCase: false,
|
||||
},
|
||||
&ruleRefExpr{
|
||||
@@ -675,7 +675,7 @@ var g = &grammar{
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 154, col: 43, offset: 3912},
|
||||
val: ")",
|
||||
val: ">",
|
||||
ignoreCase: false,
|
||||
},
|
||||
&ruleRefExpr{
|
||||
@@ -702,7 +702,7 @@ var g = &grammar{
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 156, col: 13, offset: 4015},
|
||||
val: "(",
|
||||
val: "<",
|
||||
ignoreCase: false,
|
||||
},
|
||||
&ruleRefExpr{
|
||||
@@ -723,7 +723,7 @@ var g = &grammar{
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 156, col: 28, offset: 4030},
|
||||
val: ")",
|
||||
val: ">",
|
||||
ignoreCase: false,
|
||||
},
|
||||
&ruleRefExpr{
|
||||
@@ -750,7 +750,7 @@ var g = &grammar{
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 158, col: 13, offset: 4117},
|
||||
val: "(",
|
||||
val: "<",
|
||||
ignoreCase: false,
|
||||
},
|
||||
&ruleRefExpr{
|
||||
@@ -771,7 +771,7 @@ var g = &grammar{
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 158, col: 28, offset: 4132},
|
||||
val: ")",
|
||||
val: ">",
|
||||
ignoreCase: false,
|
||||
},
|
||||
&ruleRefExpr{
|
||||
|
||||
@@ -133,8 +133,8 @@ func (suite *ImportTestSuite) TestImports() {
|
||||
alias Other = import "%s"
|
||||
alias ByPath = import "%s"
|
||||
|
||||
using List(Other.ForeignEnum)
|
||||
using List(Local1)
|
||||
using List<Other.ForeignEnum>
|
||||
using List<Local1>
|
||||
struct Local1 {
|
||||
a: Other.ForeignStruct
|
||||
b: Int16
|
||||
|
||||
@@ -47,8 +47,8 @@ func (suite *ParserTestSuite) TestAlias() {
|
||||
|
||||
func (suite *ParserTestSuite) TestUsing() {
|
||||
usingDecls := `
|
||||
using Map(String, Simple)
|
||||
using List(Noms.Commit)
|
||||
using Map<String, Simple>
|
||||
using List<Noms.Commit>
|
||||
`
|
||||
pkg := runParser("", strings.NewReader(usingDecls))
|
||||
suite.Len(pkg.UsingDeclarations, 2)
|
||||
@@ -66,7 +66,7 @@ using List(Noms.Commit)
|
||||
func (suite *ParserTestSuite) TestBadUsing() {
|
||||
suite.Panics(func() { runParser("", strings.NewReader("using Blob")) }, "Can't 'use' a primitive.")
|
||||
suite.Panics(func() { runParser("", strings.NewReader("using Noms.Commit")) }, "Can't 'use' a type from another package.")
|
||||
suite.Panics(func() { runParser("", strings.NewReader("using f@(k")) }, "Can't 'use' illegal identifier.")
|
||||
suite.Panics(func() { runParser("", strings.NewReader("using f@<k")) }, "Can't 'use' illegal identifier.")
|
||||
}
|
||||
|
||||
func (suite *ParserTestSuite) TestBadStructParse() {
|
||||
@@ -241,7 +241,7 @@ func (s structTestCase) toText() string {
|
||||
|
||||
func (s structTestCase) fieldsToString() (out string) {
|
||||
for _, f := range s.Fields {
|
||||
out += f.Name + " :"
|
||||
out += f.Name + ": "
|
||||
if f.Optional {
|
||||
out += "optional "
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
using Set(Ref(Package))
|
||||
using Set<Ref<Package>>
|
||||
|
||||
+5
-5
@@ -142,15 +142,15 @@ func (c CompoundDesc) Describe() string {
|
||||
}
|
||||
switch c.kind {
|
||||
case ListKind:
|
||||
return "List(" + descElems() + ")"
|
||||
return "List<" + descElems() + ">"
|
||||
case MapKind:
|
||||
return "Map(" + descElems() + ")"
|
||||
return "Map<" + descElems() + ">"
|
||||
case RefKind:
|
||||
return "Ref(" + descElems() + ")"
|
||||
return "Ref<" + descElems() + ">"
|
||||
case SetKind:
|
||||
return "Set(" + descElems() + ")"
|
||||
return "Set<" + descElems() + ">"
|
||||
case MetaSequenceKind:
|
||||
return "Meta(" + descElems() + ")"
|
||||
return "Meta<" + descElems() + ">"
|
||||
default:
|
||||
panic(fmt.Errorf("Kind is not compound: %v", c.kind))
|
||||
}
|
||||
|
||||
+2
-2
@@ -71,8 +71,8 @@ func TestTypeRefDescribe(t *testing.T) {
|
||||
assert.Equal("Bool", boolType.Describe())
|
||||
assert.Equal("Uint8", uint8Type.Describe())
|
||||
assert.Equal("String", stringType.Describe())
|
||||
assert.Equal("Map(String, Uint8)", mapType.Describe())
|
||||
assert.Equal("Set(String)", setType.Describe())
|
||||
assert.Equal("Map<String, Uint8>", mapType.Describe())
|
||||
assert.Equal("Set<String>", setType.Describe())
|
||||
|
||||
mahType := MakeStructType("MahStruct", []Field{
|
||||
Field{"Field1", stringType, false},
|
||||
|
||||
Reference in New Issue
Block a user