diff --git a/internal/tlcodegen/qt_meta.qtpl b/internal/tlcodegen/qt_meta.qtpl index c5e5fdcb..94b0c29d 100644 --- a/internal/tlcodegen/qt_meta.qtpl +++ b/internal/tlcodegen/qt_meta.qtpl @@ -147,6 +147,10 @@ type TLItem struct { tag uint32 annotations uint32 tlName string + + resultTypeContainsUnionTypes bool + argumentsTypesContainUnionTypes bool + createFunction func() Function createFunctionLong func() Function createObject func() Object @@ -162,6 +166,9 @@ func (item TLItem) CreateObject() Object { return item.createObject() } func (item TLItem) IsFunction() bool { return item.createFunction != nil } func (item TLItem) CreateFunction() Function { return item.createFunction() } +func (item TLItem) HasUnionTypesInResult() bool { return item.resultTypeContainsUnionTypes } +func (item TLItem) HasUnionTypesInArguments() bool { return item.argumentsTypesContainUnionTypes } + // For transcoding short-long version during Long ID transition func (item TLItem) HasFunctionLong() bool { return item.createFunctionLong != nil } func (item TLItem) CreateFunctionLong() Function { return item.createFunctionLong() } @@ -335,14 +342,22 @@ func init() { {%- if wr.tlTag == 0 || !wr.IsTopLevel() -%} {%- continue -%} {%- endif -%} {%- stripspace -%} {%- if fun, ok := wr.trw.(*TypeRWStruct); ok && len(wr.NatParams) == 0 -%} + {%- code + resultTypeContainsUnionTypes := false + argumentsTypesContainUnionTypes := false + -%} {%- if fun.ResultType != nil -%} + {%- code + resultTypeContainsUnionTypes = fun.wr.DoesReturnTypeContainUnionTypes() + argumentsTypesContainUnionTypes = fun.wr.DoArgumentsContainUnionTypes() + -%} fillFunction( {%- else -%} fillObject( {%- endif -%} "{%= wr.tlName.String() %}#{%s= fmt.Sprintf("%08x", wr.tlTag) %}", {%q= fmt.Sprintf("#%08x", wr.tlTag) %}, - &TLItem{tag: {%s= fmt.Sprintf("0x%08x", wr.tlTag) %}, annotations: {%s= fmt.Sprintf("0x%x", wr.AnnotationsMask()) %}, tlName: "{%= wr.tlName.String() %}"}) + &TLItem{tag: {%s= fmt.Sprintf("0x%08x", wr.tlTag) %}, annotations: {%s= fmt.Sprintf("0x%x", wr.AnnotationsMask()) %}, tlName: "{%= wr.tlName.String() %}", resultTypeContainsUnionTypes: {%v= resultTypeContainsUnionTypes %}, argumentsTypesContainUnionTypes: {%v= argumentsTypesContainUnionTypes %}}) {%- endif -%} {%- endstripspace -%} diff --git a/internal/tlcodegen/qt_meta.qtpl.go b/internal/tlcodegen/qt_meta.qtpl.go index 65bce294..727753d9 100644 --- a/internal/tlcodegen/qt_meta.qtpl.go +++ b/internal/tlcodegen/qt_meta.qtpl.go @@ -186,6 +186,10 @@ type TLItem struct { tag uint32 annotations uint32 tlName string + + resultTypeContainsUnionTypes bool + argumentsTypesContainUnionTypes bool + createFunction func() Function createFunctionLong func() Function createObject func() Object @@ -201,6 +205,9 @@ func (item TLItem) CreateObject() Object { return item.createObject() } func (item TLItem) IsFunction() bool { return item.createFunction != nil } func (item TLItem) CreateFunction() Function { return item.createFunction() } +func (item TLItem) HasUnionTypesInResult() bool { return item.resultTypeContainsUnionTypes } +func (item TLItem) HasUnionTypesInArguments() bool { return item.argumentsTypesContainUnionTypes } + // For transcoding short-long version during Long ID transition func (item TLItem) HasFunctionLong() bool { return item.createFunctionLong != nil } func (item TLItem) CreateFunctionLong() Function { return item.createFunctionLong() } @@ -385,7 +392,13 @@ func init() { continue } if fun, ok := wr.trw.(*TypeRWStruct); ok && len(wr.NatParams) == 0 { + resultTypeContainsUnionTypes := false + argumentsTypesContainUnionTypes := false + if fun.ResultType != nil { + resultTypeContainsUnionTypes = fun.wr.DoesReturnTypeContainUnionTypes() + argumentsTypesContainUnionTypes = fun.wr.DoArgumentsContainUnionTypes() + qw422016.N().S(`fillFunction(`) } else { qw422016.N().S(`fillObject(`) @@ -402,7 +415,11 @@ func init() { qw422016.N().S(fmt.Sprintf("0x%x", wr.AnnotationsMask())) qw422016.N().S(`, tlName: "`) wr.tlName.StreamString(qw422016) - qw422016.N().S(`"})`) + qw422016.N().S(`", resultTypeContainsUnionTypes:`) + qw422016.N().V(resultTypeContainsUnionTypes) + qw422016.N().S(`, argumentsTypesContainUnionTypes:`) + qw422016.N().V(argumentsTypesContainUnionTypes) + qw422016.N().S(`})`) } qw422016.N().S(` `) diff --git a/internal/tlcodegen/test/codegen_test/goldmaster_invariants_test.go b/internal/tlcodegen/test/codegen_test/goldmaster_invariants_test.go new file mode 100644 index 00000000..7cef8063 --- /dev/null +++ b/internal/tlcodegen/test/codegen_test/goldmaster_invariants_test.go @@ -0,0 +1,53 @@ +package codegen + +import ( + "github.com/stretchr/testify/assert" + "testing" +) +import "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/meta" + +func TestFunctionHasUnion(t *testing.T) { + { + // test type which contains union in its recursive definition + fun := meta.FactoryItemByTLName("service5.insertList") + if assert.NotNil(t, fun) { + assert.True(t, fun.IsFunction()) + assert.True(t, fun.HasUnionTypesInResult()) + } + } + { + // test type which doesn't contain union in its recursive definition + fun := meta.FactoryItemByTLName("usefulService.getUserEntity") + if assert.NotNil(t, fun) { + assert.True(t, fun.IsFunction()) + assert.True(t, !fun.HasUnionTypesInResult()) + } + } + { + // test type which contains enum in its recursive definition + fun := meta.FactoryItemByTLName("ab.call10") + if assert.NotNil(t, fun) { + assert.True(t, fun.IsFunction()) + assert.True(t, fun.HasUnionTypesInResult()) + } + } +} + +func TestFunctionHasUnionInArguments(t *testing.T) { + { + // test type which contains union in its recursive definition + fun := meta.FactoryItemByTLName("service5.insertList") + if assert.NotNil(t, fun) { + assert.True(t, fun.IsFunction()) + assert.True(t, !fun.HasUnionTypesInArguments()) + } + } + { + // test type which doesn't contain union in its recursive definition + fun := meta.FactoryItemByTLName("ab.call11") + if assert.NotNil(t, fun) { + assert.True(t, fun.IsFunction()) + assert.True(t, fun.HasUnionTypesInArguments()) + } + } +} diff --git a/internal/tlcodegen/test/gen/cases/meta/meta.go b/internal/tlcodegen/test/gen/cases/meta/meta.go index 8276c719..f132b926 100644 --- a/internal/tlcodegen/test/gen/cases/meta/meta.go +++ b/internal/tlcodegen/test/gen/cases/meta/meta.go @@ -127,9 +127,13 @@ func CreateObjectFromNameBytes(name string) Object { } type TLItem struct { - tag uint32 - annotations uint32 - tlName string + tag uint32 + annotations uint32 + tlName string + + resultTypeContainsUnionTypes bool + argumentsTypesContainUnionTypes bool + createFunction func() Function createFunctionLong func() Function createObject func() Object @@ -144,6 +148,9 @@ func (item TLItem) CreateObject() Object { return item.createObject() } func (item TLItem) IsFunction() bool { return item.createFunction != nil } func (item TLItem) CreateFunction() Function { return item.createFunction() } +func (item TLItem) HasUnionTypesInResult() bool { return item.resultTypeContainsUnionTypes } +func (item TLItem) HasUnionTypesInArguments() bool { return item.argumentsTypesContainUnionTypes } + // For transcoding short-long version during Long ID transition func (item TLItem) HasFunctionLong() bool { return item.createFunctionLong != nil } func (item TLItem) CreateFunctionLong() Function { return item.createFunctionLong() } @@ -294,52 +301,52 @@ func fillFunction(n1 string, n2 string, item *TLItem) { } func init() { - fillObject("benchmarks.vruhash#d31bd0fd", "#d31bd0fd", &TLItem{tag: 0xd31bd0fd, annotations: 0x0, tlName: "benchmarks.vruhash"}) - fillObject("benchmarks.vruposition#32792c04", "#32792c04", &TLItem{tag: 0x32792c04, annotations: 0x0, tlName: "benchmarks.vruposition"}) - fillObject("benchmarks.vrutoyTopLevelContainer#fb442ca5", "#fb442ca5", &TLItem{tag: 0xfb442ca5, annotations: 0x0, tlName: "benchmarks.vrutoyTopLevelContainer"}) - fillObject("benchmarks.vrutoyTopLevelContainerWithDependency#c176008e", "#c176008e", &TLItem{tag: 0xc176008e, annotations: 0x0, tlName: "benchmarks.vrutoyTopLevelContainerWithDependency"}) - fillObject("benchmarks.vrutoytopLevelUnionBig#ef556bee", "#ef556bee", &TLItem{tag: 0xef556bee, annotations: 0x0, tlName: "benchmarks.vrutoytopLevelUnionBig"}) - fillObject("benchmarks.vrutoytopLevelUnionEmpty#ce27c770", "#ce27c770", &TLItem{tag: 0xce27c770, annotations: 0x0, tlName: "benchmarks.vrutoytopLevelUnionEmpty"}) - fillObject("cases_bytes.testArray#3762fb81", "#3762fb81", &TLItem{tag: 0x3762fb81, annotations: 0x0, tlName: "cases_bytes.testArray"}) - fillObject("cases_bytes.testDictAny#5a5fce57", "#5a5fce57", &TLItem{tag: 0x5a5fce57, annotations: 0x0, tlName: "cases_bytes.testDictAny"}) - fillObject("cases_bytes.testDictInt#453ace07", "#453ace07", &TLItem{tag: 0x453ace07, annotations: 0x0, tlName: "cases_bytes.testDictInt"}) - fillObject("cases_bytes.testDictString#6c04d6ce", "#6c04d6ce", &TLItem{tag: 0x6c04d6ce, annotations: 0x0, tlName: "cases_bytes.testDictString"}) - fillObject("cases_bytes.testDictStringString#ad69c772", "#ad69c772", &TLItem{tag: 0xad69c772, annotations: 0x0, tlName: "cases_bytes.testDictStringString"}) - fillObject("cases_bytes.testEnum1#58aad3f5", "#58aad3f5", &TLItem{tag: 0x58aad3f5, annotations: 0x0, tlName: "cases_bytes.testEnum1"}) - fillObject("cases_bytes.testEnum2#00b47add", "#00b47add", &TLItem{tag: 0x00b47add, annotations: 0x0, tlName: "cases_bytes.testEnum2"}) - fillObject("cases_bytes.testEnum3#81911ffa", "#81911ffa", &TLItem{tag: 0x81911ffa, annotations: 0x0, tlName: "cases_bytes.testEnum3"}) - fillObject("cases_bytes.testEnumContainer#32b92037", "#32b92037", &TLItem{tag: 0x32b92037, annotations: 0x0, tlName: "cases_bytes.testEnumContainer"}) - fillObject("cases_bytes.testTuple#2dd3bacf", "#2dd3bacf", &TLItem{tag: 0x2dd3bacf, annotations: 0x0, tlName: "cases_bytes.testTuple"}) - fillObject("cases_bytes.testVector#3647c8ae", "#3647c8ae", &TLItem{tag: 0x3647c8ae, annotations: 0x0, tlName: "cases_bytes.testVector"}) - fillObject("cases.myCycle1#d3ca919d", "#d3ca919d", &TLItem{tag: 0xd3ca919d, annotations: 0x0, tlName: "cases.myCycle1"}) - fillObject("cases.myCycle2#5444c9a2", "#5444c9a2", &TLItem{tag: 0x5444c9a2, annotations: 0x0, tlName: "cases.myCycle2"}) - fillObject("cases.myCycle3#7624f86b", "#7624f86b", &TLItem{tag: 0x7624f86b, annotations: 0x0, tlName: "cases.myCycle3"}) - fillObject("cases.replace7#6ccce4be", "#6ccce4be", &TLItem{tag: 0x6ccce4be, annotations: 0x0, tlName: "cases.replace7"}) - fillObject("cases.replace7plus#197858f5", "#197858f5", &TLItem{tag: 0x197858f5, annotations: 0x0, tlName: "cases.replace7plus"}) - fillObject("cases.replace7plusplus#abc39b68", "#abc39b68", &TLItem{tag: 0xabc39b68, annotations: 0x0, tlName: "cases.replace7plusplus"}) - fillObject("cases.testAllPossibleFieldConfigsContainer#e3fae936", "#e3fae936", &TLItem{tag: 0xe3fae936, annotations: 0x0, tlName: "cases.testAllPossibleFieldConfigsContainer"}) - fillObject("cases.testArray#a888030d", "#a888030d", &TLItem{tag: 0xa888030d, annotations: 0x0, tlName: "cases.testArray"}) - fillObject("cases.testBeforeReadBitValidation#9b2396db", "#9b2396db", &TLItem{tag: 0x9b2396db, annotations: 0x0, tlName: "cases.testBeforeReadBitValidation"}) - fillObject("cases.testDictAny#e29b8ae6", "#e29b8ae6", &TLItem{tag: 0xe29b8ae6, annotations: 0x0, tlName: "cases.testDictAny"}) - fillObject("cases.testDictInt#d3877643", "#d3877643", &TLItem{tag: 0xd3877643, annotations: 0x0, tlName: "cases.testDictInt"}) - fillObject("cases.testDictString#c463c79b", "#c463c79b", &TLItem{tag: 0xc463c79b, annotations: 0x0, tlName: "cases.testDictString"}) - fillObject("cases.testEnum1#6c6c55ac", "#6c6c55ac", &TLItem{tag: 0x6c6c55ac, annotations: 0x0, tlName: "cases.testEnum1"}) - fillObject("cases.testEnum2#86ea88ce", "#86ea88ce", &TLItem{tag: 0x86ea88ce, annotations: 0x0, tlName: "cases.testEnum2"}) - fillObject("cases.testEnum3#69b83e2f", "#69b83e2f", &TLItem{tag: 0x69b83e2f, annotations: 0x0, tlName: "cases.testEnum3"}) - fillObject("cases.testEnumContainer#cb684231", "#cb684231", &TLItem{tag: 0xcb684231, annotations: 0x0, tlName: "cases.testEnumContainer"}) - fillObject("cases.testLocalFieldmask#f68fd3f9", "#f68fd3f9", &TLItem{tag: 0xf68fd3f9, annotations: 0x0, tlName: "cases.testLocalFieldmask"}) - fillObject("cases.testMaybe#d6602613", "#d6602613", &TLItem{tag: 0xd6602613, annotations: 0x0, tlName: "cases.testMaybe"}) - fillObject("cases.testOutFieldMaskContainer#1850ffe4", "#1850ffe4", &TLItem{tag: 0x1850ffe4, annotations: 0x0, tlName: "cases.testOutFieldMaskContainer"}) - fillObject("cases.testRecursiveFieldMask#c58cf85e", "#c58cf85e", &TLItem{tag: 0xc58cf85e, annotations: 0x0, tlName: "cases.testRecursiveFieldMask"}) - fillObject("cases.testTuple#4b9caf8f", "#4b9caf8f", &TLItem{tag: 0x4b9caf8f, annotations: 0x0, tlName: "cases.testTuple"}) - fillObject("cases.testUnion1#4b4f09b1", "#4b4f09b1", &TLItem{tag: 0x4b4f09b1, annotations: 0x0, tlName: "cases.testUnion1"}) - fillObject("cases.testUnion2#464f96c4", "#464f96c4", &TLItem{tag: 0x464f96c4, annotations: 0x0, tlName: "cases.testUnion2"}) - fillObject("cases.testUnionContainer#4497a381", "#4497a381", &TLItem{tag: 0x4497a381, annotations: 0x0, tlName: "cases.testUnionContainer"}) - fillObject("cases.testVector#4975695c", "#4975695c", &TLItem{tag: 0x4975695c, annotations: 0x0, tlName: "cases.testVector"}) - fillObject("int#a8509bda", "#a8509bda", &TLItem{tag: 0xa8509bda, annotations: 0x0, tlName: "int"}) - fillObject("int32#7934e71f", "#7934e71f", &TLItem{tag: 0x7934e71f, annotations: 0x0, tlName: "int32"}) - fillObject("int64#f5609de0", "#f5609de0", &TLItem{tag: 0xf5609de0, annotations: 0x0, tlName: "int64"}) - fillObject("long#22076cba", "#22076cba", &TLItem{tag: 0x22076cba, annotations: 0x0, tlName: "long"}) - fillObject("string#b5286e24", "#b5286e24", &TLItem{tag: 0xb5286e24, annotations: 0x0, tlName: "string"}) - fillObject("true#3fedd339", "#3fedd339", &TLItem{tag: 0x3fedd339, annotations: 0x0, tlName: "true"}) + fillObject("benchmarks.vruhash#d31bd0fd", "#d31bd0fd", &TLItem{tag: 0xd31bd0fd, annotations: 0x0, tlName: "benchmarks.vruhash", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("benchmarks.vruposition#32792c04", "#32792c04", &TLItem{tag: 0x32792c04, annotations: 0x0, tlName: "benchmarks.vruposition", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("benchmarks.vrutoyTopLevelContainer#fb442ca5", "#fb442ca5", &TLItem{tag: 0xfb442ca5, annotations: 0x0, tlName: "benchmarks.vrutoyTopLevelContainer", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("benchmarks.vrutoyTopLevelContainerWithDependency#c176008e", "#c176008e", &TLItem{tag: 0xc176008e, annotations: 0x0, tlName: "benchmarks.vrutoyTopLevelContainerWithDependency", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("benchmarks.vrutoytopLevelUnionBig#ef556bee", "#ef556bee", &TLItem{tag: 0xef556bee, annotations: 0x0, tlName: "benchmarks.vrutoytopLevelUnionBig", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("benchmarks.vrutoytopLevelUnionEmpty#ce27c770", "#ce27c770", &TLItem{tag: 0xce27c770, annotations: 0x0, tlName: "benchmarks.vrutoytopLevelUnionEmpty", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases_bytes.testArray#3762fb81", "#3762fb81", &TLItem{tag: 0x3762fb81, annotations: 0x0, tlName: "cases_bytes.testArray", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases_bytes.testDictAny#5a5fce57", "#5a5fce57", &TLItem{tag: 0x5a5fce57, annotations: 0x0, tlName: "cases_bytes.testDictAny", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases_bytes.testDictInt#453ace07", "#453ace07", &TLItem{tag: 0x453ace07, annotations: 0x0, tlName: "cases_bytes.testDictInt", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases_bytes.testDictString#6c04d6ce", "#6c04d6ce", &TLItem{tag: 0x6c04d6ce, annotations: 0x0, tlName: "cases_bytes.testDictString", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases_bytes.testDictStringString#ad69c772", "#ad69c772", &TLItem{tag: 0xad69c772, annotations: 0x0, tlName: "cases_bytes.testDictStringString", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases_bytes.testEnum1#58aad3f5", "#58aad3f5", &TLItem{tag: 0x58aad3f5, annotations: 0x0, tlName: "cases_bytes.testEnum1", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases_bytes.testEnum2#00b47add", "#00b47add", &TLItem{tag: 0x00b47add, annotations: 0x0, tlName: "cases_bytes.testEnum2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases_bytes.testEnum3#81911ffa", "#81911ffa", &TLItem{tag: 0x81911ffa, annotations: 0x0, tlName: "cases_bytes.testEnum3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases_bytes.testEnumContainer#32b92037", "#32b92037", &TLItem{tag: 0x32b92037, annotations: 0x0, tlName: "cases_bytes.testEnumContainer", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases_bytes.testTuple#2dd3bacf", "#2dd3bacf", &TLItem{tag: 0x2dd3bacf, annotations: 0x0, tlName: "cases_bytes.testTuple", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases_bytes.testVector#3647c8ae", "#3647c8ae", &TLItem{tag: 0x3647c8ae, annotations: 0x0, tlName: "cases_bytes.testVector", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.myCycle1#d3ca919d", "#d3ca919d", &TLItem{tag: 0xd3ca919d, annotations: 0x0, tlName: "cases.myCycle1", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.myCycle2#5444c9a2", "#5444c9a2", &TLItem{tag: 0x5444c9a2, annotations: 0x0, tlName: "cases.myCycle2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.myCycle3#7624f86b", "#7624f86b", &TLItem{tag: 0x7624f86b, annotations: 0x0, tlName: "cases.myCycle3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.replace7#6ccce4be", "#6ccce4be", &TLItem{tag: 0x6ccce4be, annotations: 0x0, tlName: "cases.replace7", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.replace7plus#197858f5", "#197858f5", &TLItem{tag: 0x197858f5, annotations: 0x0, tlName: "cases.replace7plus", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.replace7plusplus#abc39b68", "#abc39b68", &TLItem{tag: 0xabc39b68, annotations: 0x0, tlName: "cases.replace7plusplus", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testAllPossibleFieldConfigsContainer#e3fae936", "#e3fae936", &TLItem{tag: 0xe3fae936, annotations: 0x0, tlName: "cases.testAllPossibleFieldConfigsContainer", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testArray#a888030d", "#a888030d", &TLItem{tag: 0xa888030d, annotations: 0x0, tlName: "cases.testArray", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testBeforeReadBitValidation#9b2396db", "#9b2396db", &TLItem{tag: 0x9b2396db, annotations: 0x0, tlName: "cases.testBeforeReadBitValidation", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testDictAny#e29b8ae6", "#e29b8ae6", &TLItem{tag: 0xe29b8ae6, annotations: 0x0, tlName: "cases.testDictAny", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testDictInt#d3877643", "#d3877643", &TLItem{tag: 0xd3877643, annotations: 0x0, tlName: "cases.testDictInt", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testDictString#c463c79b", "#c463c79b", &TLItem{tag: 0xc463c79b, annotations: 0x0, tlName: "cases.testDictString", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testEnum1#6c6c55ac", "#6c6c55ac", &TLItem{tag: 0x6c6c55ac, annotations: 0x0, tlName: "cases.testEnum1", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testEnum2#86ea88ce", "#86ea88ce", &TLItem{tag: 0x86ea88ce, annotations: 0x0, tlName: "cases.testEnum2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testEnum3#69b83e2f", "#69b83e2f", &TLItem{tag: 0x69b83e2f, annotations: 0x0, tlName: "cases.testEnum3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testEnumContainer#cb684231", "#cb684231", &TLItem{tag: 0xcb684231, annotations: 0x0, tlName: "cases.testEnumContainer", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testLocalFieldmask#f68fd3f9", "#f68fd3f9", &TLItem{tag: 0xf68fd3f9, annotations: 0x0, tlName: "cases.testLocalFieldmask", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testMaybe#d6602613", "#d6602613", &TLItem{tag: 0xd6602613, annotations: 0x0, tlName: "cases.testMaybe", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testOutFieldMaskContainer#1850ffe4", "#1850ffe4", &TLItem{tag: 0x1850ffe4, annotations: 0x0, tlName: "cases.testOutFieldMaskContainer", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testRecursiveFieldMask#c58cf85e", "#c58cf85e", &TLItem{tag: 0xc58cf85e, annotations: 0x0, tlName: "cases.testRecursiveFieldMask", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testTuple#4b9caf8f", "#4b9caf8f", &TLItem{tag: 0x4b9caf8f, annotations: 0x0, tlName: "cases.testTuple", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testUnion1#4b4f09b1", "#4b4f09b1", &TLItem{tag: 0x4b4f09b1, annotations: 0x0, tlName: "cases.testUnion1", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testUnion2#464f96c4", "#464f96c4", &TLItem{tag: 0x464f96c4, annotations: 0x0, tlName: "cases.testUnion2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testUnionContainer#4497a381", "#4497a381", &TLItem{tag: 0x4497a381, annotations: 0x0, tlName: "cases.testUnionContainer", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cases.testVector#4975695c", "#4975695c", &TLItem{tag: 0x4975695c, annotations: 0x0, tlName: "cases.testVector", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("int#a8509bda", "#a8509bda", &TLItem{tag: 0xa8509bda, annotations: 0x0, tlName: "int", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("int32#7934e71f", "#7934e71f", &TLItem{tag: 0x7934e71f, annotations: 0x0, tlName: "int32", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("int64#f5609de0", "#f5609de0", &TLItem{tag: 0xf5609de0, annotations: 0x0, tlName: "int64", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("long#22076cba", "#22076cba", &TLItem{tag: 0x22076cba, annotations: 0x0, tlName: "long", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("string#b5286e24", "#b5286e24", &TLItem{tag: 0xb5286e24, annotations: 0x0, tlName: "string", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("true#3fedd339", "#3fedd339", &TLItem{tag: 0x3fedd339, annotations: 0x0, tlName: "true", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) } diff --git a/internal/tlcodegen/test/gen/goldmaster.tlo.json b/internal/tlcodegen/test/gen/goldmaster.tlo.json index 445984bd..bbd01575 100644 --- a/internal/tlcodegen/test/gen/goldmaster.tlo.json +++ b/internal/tlcodegen/test/gen/goldmaster.tlo.json @@ -1,7 +1,7 @@ { "version": 301822800, "date": 301822800, - "types_num": 99, + "types_num": 100, "types": [ { "name": 1885708031, @@ -108,6 +108,12 @@ "id": "Int64", "constructors_num": 1 }, + { + "name": 47713501, + "id": "List", + "constructors_num": 1, + "arity": 1 + }, { "name": 570911930, "id": "Long", @@ -555,7 +561,7 @@ "params_type": 1 } ], - "constructor_num": 114, + "constructor_num": 115, "constructors": [ { "type": "tls.combinator_v4", @@ -1909,6 +1915,99 @@ } } }, + { + "type": "tls.combinator_v4", + "value": { + "name": 47713501, + "id": "list", + "type_name": 47713501, + "left": { + "type": "tls.combinatorLeft", + "value": { + "args_num": 4, + "args": [ + { + "id": "X", + "flags": 131075, + "var_num": 0, + "type": { + "type": "tls.typeExpr", + "value": { + "name": 753727511 + } + } + }, + { + "id": "flag", + "flags": 2, + "var_num": 1, + "type": { + "type": "tls.typeExpr", + "value": { + "name": 1885708031 + } + } + }, + { + "id": "head", + "flags": 4, + "exist_var_num": 1, + "exist_var_bit": 0, + "type": { + "type": "tls.typeVar", + "value": {} + } + }, + { + "id": "tail", + "flags": 4, + "exist_var_num": 1, + "exist_var_bit": 0, + "type": { + "type": "tls.typeExpr", + "value": { + "name": 47713501, + "flags": 1, + "children_num": 1, + "children": [ + { + "type": "tls.exprType", + "value": { + "expr": { + "type": "tls.typeVar", + "value": {} + } + } + } + ] + } + } + } + ] + } + }, + "right": { + "value": { + "type": "tls.typeExpr", + "value": { + "name": 47713501, + "children_num": 1, + "children": [ + { + "type": "tls.exprType", + "value": { + "expr": { + "type": "tls.typeVar", + "value": {} + } + } + } + ] + } + } + } + } + }, { "type": "tls.combinator_v4", "value": { @@ -9289,7 +9388,7 @@ } } ], - "functions_num": 21, + "functions_num": 24, "functions": [ { "type": "tls.combinator_v4", @@ -9326,6 +9425,61 @@ "flags": 1 } }, + { + "type": "tls.combinator_v4", + "value": { + "name": -1917672200, + "id": "ab.call10", + "type_name": -516647077, + "left": { + "type": "tls.combinatorLeft", + "value": {} + }, + "right": { + "value": { + "type": "tls.typeExpr", + "value": { + "name": -516647077 + } + } + }, + "flags": 1 + } + }, + { + "type": "tls.combinator_v4", + "value": { + "name": -323837076, + "id": "ab.call11", + "type_name": -516647077, + "left": { + "type": "tls.combinatorLeft", + "value": { + "args_num": 1, + "args": [ + { + "id": "x", + "type": { + "type": "tls.typeExpr", + "value": { + "name": -516647077 + } + } + } + ] + } + }, + "right": { + "value": { + "type": "tls.typeExpr", + "value": { + "name": -516647077 + } + } + }, + "flags": 1 + } + }, { "type": "tls.combinator_v4", "value": { @@ -9970,6 +10124,69 @@ "flags": 3 } }, + { + "type": "tls.combinator_v4", + "value": { + "name": 2096325308, + "id": "service5.insertList", + "type_name": 47713501, + "left": { + "type": "tls.combinatorLeft", + "value": { + "args_num": 2, + "args": [ + { + "id": "flags", + "flags": 2, + "var_num": 0, + "type": { + "type": "tls.typeExpr", + "value": { + "name": 1885708031 + } + } + }, + { + "id": "persistent", + "flags": 4, + "exist_var_num": 0, + "exist_var_bit": 0, + "type": { + "type": "tls.typeExpr", + "value": { + "name": 1072550713, + "flags": 1 + } + } + } + ] + } + }, + "right": { + "value": { + "type": "tls.typeExpr", + "value": { + "name": 47713501, + "children_num": 1, + "children": [ + { + "type": "tls.exprType", + "value": { + "expr": { + "type": "tls.typeExpr", + "value": { + "name": 597193292 + } + } + } + } + ] + } + } + }, + "flags": 3 + } + }, { "type": "tls.combinator_v4", "value": { diff --git a/internal/tlcodegen/test/gen/goldmaster/constants/constants.go b/internal/tlcodegen/test/gen/goldmaster/constants/constants.go index c75b695a..c60bb096 100644 --- a/internal/tlcodegen/test/gen/goldmaster/constants/constants.go +++ b/internal/tlcodegen/test/gen/goldmaster/constants/constants.go @@ -21,6 +21,8 @@ const ( Aaa = 0x05b0e500 // aaa AbAlias = 0x944aaa97 // ab.alias AbCall1 = 0x20c5fb2d // ab.call1 + AbCall10 = 0x8db2a4f8 // ab.call10 + AbCall11 = 0xecb2a36c // ab.call11 AbCall2 = 0x77d5f057 // ab.call2 AbCall3 = 0x0a083445 // ab.call3 AbCall4 = 0xc1220a1e // ab.call4 @@ -82,6 +84,7 @@ const ( Int = 0xa8509bda // int Int32 = 0x7934e71f // int32 Int64 = 0xf5609de0 // int64 + List = 0x02d80cdd // list Long = 0x22076cba // long MaybeTest1 = 0xc457763c // maybeTest1 MaybeWrapper = 0x723390c4 // maybeWrapper @@ -118,6 +121,7 @@ const ( ResultTrue = 0x3f9c8ef8 // resultTrue Service5EmptyOutput = 0xff8f7db8 // service5.emptyOutput Service5Insert = 0x7cf362ba // service5.insert + Service5InsertList = 0x7cf362bc // service5.insertList Service5StringOutput = 0xdc170ff4 // service5.stringOutput Service5LongEmptyOutput = 0xff8f7db9 // service5Long.emptyOutput Service5LongInsert = 0x7cf362bb // service5Long.insert diff --git a/internal/tlcodegen/test/gen/goldmaster/factory/factory.go b/internal/tlcodegen/test/gen/goldmaster/factory/factory.go index 491ea633..b7e76e64 100644 --- a/internal/tlcodegen/test/gen/goldmaster/factory/factory.go +++ b/internal/tlcodegen/test/gen/goldmaster/factory/factory.go @@ -67,6 +67,8 @@ import ( "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlUseTrue" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tla/tlATop2" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall1" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall10" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall11" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall2" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall3" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall4" @@ -93,6 +95,7 @@ import ( "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlcd/tlCdTypeD" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlcd/tlCdUseCycle" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlservice5/tlService5Insert" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlservice5/tlService5InsertList" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlservice5Long/tlService5LongInsert" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlusefulService/tlUsefulServiceGetUserEntity" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/meta" @@ -125,6 +128,8 @@ func init() { meta.SetGlobalFactoryCreateForObject(0xa7662843, func() meta.Object { var ret cycle_463e8ce0a74f5ec3e904ecdc85b1b857.AUNionA; return &ret }) meta.SetGlobalFactoryCreateForObject(0x944aaa97, func() meta.Object { var ret cycle_b62dd5050d0a18c7485fd980c087f32c.AbAlias; return &ret }) meta.SetGlobalFactoryCreateForFunction(0x20c5fb2d, func() meta.Object { var ret tlAbCall1.AbCall1; return &ret }, func() meta.Function { var ret tlAbCall1.AbCall1; return &ret }, nil) + meta.SetGlobalFactoryCreateForFunction(0x8db2a4f8, func() meta.Object { var ret tlAbCall10.AbCall10; return &ret }, func() meta.Function { var ret tlAbCall10.AbCall10; return &ret }, nil) + meta.SetGlobalFactoryCreateForFunction(0xecb2a36c, func() meta.Object { var ret tlAbCall11.AbCall11; return &ret }, func() meta.Function { var ret tlAbCall11.AbCall11; return &ret }, nil) meta.SetGlobalFactoryCreateForFunction(0x77d5f057, func() meta.Object { var ret tlAbCall2.AbCall2; return &ret }, func() meta.Function { var ret tlAbCall2.AbCall2; return &ret }, nil) meta.SetGlobalFactoryCreateForFunction(0x0a083445, func() meta.Object { var ret tlAbCall3.AbCall3; return &ret }, func() meta.Function { var ret tlAbCall3.AbCall3; return &ret }, nil) meta.SetGlobalFactoryCreateForFunction(0xc1220a1e, func() meta.Object { var ret tlAbCall4.AbCall4; return &ret }, func() meta.Function { var ret tlAbCall4.AbCall4; return &ret }, nil) @@ -208,6 +213,7 @@ func init() { meta.SetGlobalFactoryCreateForObject(0x95d598c5, func() meta.Object { var ret tlReplace9.Replace9; return &ret }) meta.SetGlobalFactoryCreateForObject(0xff8f7db8, func() meta.Object { var ret cycle_16847572a0831d4cd4c0c0fb513151f3.Service5EmptyOutput; return &ret }) meta.SetGlobalFactoryCreateForFunction(0x7cf362ba, func() meta.Object { var ret tlService5Insert.Service5Insert; return &ret }, func() meta.Function { var ret tlService5Insert.Service5Insert; return &ret }, func() meta.Function { var ret tlService5LongInsert.Service5LongInsert; return &ret }) + meta.SetGlobalFactoryCreateForFunction(0x7cf362bc, func() meta.Object { var ret tlService5InsertList.Service5InsertList; return &ret }, func() meta.Function { var ret tlService5InsertList.Service5InsertList; return &ret }, nil) meta.SetGlobalFactoryCreateForObject(0xff8f7db9, func() meta.Object { var ret cycle_98d4570147919cfd6f6ebfc47c3e10a0.Service5LongEmptyOutput return &ret diff --git a/internal/tlcodegen/test/gen/goldmaster/factory_bytes/factory_bytes.go b/internal/tlcodegen/test/gen/goldmaster/factory_bytes/factory_bytes.go index 7fceb6e7..49a70b17 100644 --- a/internal/tlcodegen/test/gen/goldmaster/factory_bytes/factory_bytes.go +++ b/internal/tlcodegen/test/gen/goldmaster/factory_bytes/factory_bytes.go @@ -67,6 +67,8 @@ import ( "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlUseTrue" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tla/tlATop2" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall1" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall10" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall11" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall2" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall3" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall4" @@ -93,6 +95,7 @@ import ( "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlcd/tlCdTypeD" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlcd/tlCdUseCycle" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlservice5/tlService5Insert" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlservice5/tlService5InsertList" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlservice5Long/tlService5LongInsert" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlusefulService/tlUsefulServiceGetUserEntity" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/meta" @@ -125,6 +128,8 @@ func init() { meta.SetGlobalFactoryCreateForObjectBytes(0xa7662843, func() meta.Object { var ret cycle_463e8ce0a74f5ec3e904ecdc85b1b857.AUNionA; return &ret }) meta.SetGlobalFactoryCreateForObjectBytes(0x944aaa97, func() meta.Object { var ret cycle_b62dd5050d0a18c7485fd980c087f32c.AbAlias; return &ret }) meta.SetGlobalFactoryCreateForFunctionBytes(0x20c5fb2d, func() meta.Object { var ret tlAbCall1.AbCall1; return &ret }, func() meta.Function { var ret tlAbCall1.AbCall1; return &ret }, nil) + meta.SetGlobalFactoryCreateForFunctionBytes(0x8db2a4f8, func() meta.Object { var ret tlAbCall10.AbCall10; return &ret }, func() meta.Function { var ret tlAbCall10.AbCall10; return &ret }, nil) + meta.SetGlobalFactoryCreateForFunctionBytes(0xecb2a36c, func() meta.Object { var ret tlAbCall11.AbCall11; return &ret }, func() meta.Function { var ret tlAbCall11.AbCall11; return &ret }, nil) meta.SetGlobalFactoryCreateForFunctionBytes(0x77d5f057, func() meta.Object { var ret tlAbCall2.AbCall2; return &ret }, func() meta.Function { var ret tlAbCall2.AbCall2; return &ret }, nil) meta.SetGlobalFactoryCreateForFunctionBytes(0x0a083445, func() meta.Object { var ret tlAbCall3.AbCall3; return &ret }, func() meta.Function { var ret tlAbCall3.AbCall3; return &ret }, nil) meta.SetGlobalFactoryCreateForFunctionBytes(0xc1220a1e, func() meta.Object { var ret tlAbCall4.AbCall4; return &ret }, func() meta.Function { var ret tlAbCall4.AbCall4; return &ret }, nil) @@ -208,6 +213,7 @@ func init() { meta.SetGlobalFactoryCreateForObjectBytes(0x95d598c5, func() meta.Object { var ret tlReplace9.Replace9; return &ret }) meta.SetGlobalFactoryCreateForObjectBytes(0xff8f7db8, func() meta.Object { var ret cycle_16847572a0831d4cd4c0c0fb513151f3.Service5EmptyOutput; return &ret }) meta.SetGlobalFactoryCreateForFunctionBytes(0x7cf362ba, func() meta.Object { var ret tlService5Insert.Service5Insert; return &ret }, func() meta.Function { var ret tlService5Insert.Service5Insert; return &ret }, func() meta.Function { var ret tlService5LongInsert.Service5LongInsert; return &ret }) + meta.SetGlobalFactoryCreateForFunctionBytes(0x7cf362bc, func() meta.Object { var ret tlService5InsertList.Service5InsertList; return &ret }, func() meta.Function { var ret tlService5InsertList.Service5InsertList; return &ret }, nil) meta.SetGlobalFactoryCreateForObjectBytes(0xff8f7db9, func() meta.Object { var ret cycle_98d4570147919cfd6f6ebfc47c3e10a0.Service5LongEmptyOutput return &ret diff --git a/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlListService5Output/list.go b/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlListService5Output/list.go new file mode 100644 index 00000000..4d3f1360 --- /dev/null +++ b/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlListService5Output/list.go @@ -0,0 +1,264 @@ +// Copyright 2022 V Kontakte LLC +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +// Code generated by vktl/cmd/tlgen2; DO NOT EDIT. +package tlListService5Output + +import ( + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/cycle_16847572a0831d4cd4c0c0fb513151f3" + "github.com/vkcom/tl/pkg/basictl" +) + +var _ = basictl.NatWrite +var _ = internal.ErrorInvalidEnumTag + +type ListService5Output struct { + Flag uint32 + Head cycle_16847572a0831d4cd4c0c0fb513151f3.Service5Output // Conditional: item.Flag.0 + Tail *ListService5Output // Conditional: item.Flag.0 +} + +func (ListService5Output) TLName() string { return "list" } +func (ListService5Output) TLTag() uint32 { return 0x02d80cdd } + +func (item *ListService5Output) SetHead(v cycle_16847572a0831d4cd4c0c0fb513151f3.Service5Output) { + item.Head = v + item.Flag |= 1 << 0 +} +func (item *ListService5Output) ClearHead() { + item.Head.Reset() + item.Flag &^= 1 << 0 +} +func (item ListService5Output) IsSetHead() bool { return item.Flag&(1<<0) != 0 } + +func (item *ListService5Output) SetTail(v ListService5Output) { + if item.Tail == nil { + var value ListService5Output + item.Tail = &value + } + *item.Tail = v + item.Flag |= 1 << 0 +} +func (item *ListService5Output) ClearTail() { + if item.Tail != nil { + item.Tail.Reset() + } + item.Flag &^= 1 << 0 +} +func (item ListService5Output) IsSetTail() bool { return item.Flag&(1<<0) != 0 } + +func (item *ListService5Output) Reset() { + item.Flag = 0 + item.Head.Reset() + if item.Tail != nil { + item.Tail.Reset() + } +} + +func (item *ListService5Output) FillRandom(rg *basictl.RandGenerator) { + var maskFlag uint32 + maskFlag = basictl.RandomUint(rg) + item.Flag = 0 + if maskFlag&(1<<0) != 0 { + item.Flag |= (1 << 0) + } + if item.Flag&(1<<0) != 0 { + item.Head.FillRandom(rg) + } else { + item.Head.Reset() + } + if item.Flag&(1<<0) != 0 { + rg.IncreaseDepth() + if item.Tail == nil { + var value ListService5Output + item.Tail = &value + } + item.Tail.FillRandom(rg) + rg.DecreaseDepth() + } else { + if item.Tail != nil { + item.Tail.Reset() + } + } +} + +func (item *ListService5Output) Read(w []byte) (_ []byte, err error) { + if w, err = basictl.NatRead(w, &item.Flag); err != nil { + return w, err + } + if item.Flag&(1<<0) != 0 { + if w, err = item.Head.ReadBoxed(w); err != nil { + return w, err + } + } else { + item.Head.Reset() + } + if item.Flag&(1<<0) != 0 { + if item.Tail == nil { + var value ListService5Output + item.Tail = &value + } + if w, err = item.Tail.Read(w); err != nil { + return w, err + } + } else { + if item.Tail != nil { + item.Tail.Reset() + } + } + return w, nil +} + +// This method is general version of Write, use it instead! +func (item *ListService5Output) WriteGeneral(w []byte) (_ []byte, err error) { + return item.Write(w), nil +} + +func (item *ListService5Output) Write(w []byte) []byte { + w = basictl.NatWrite(w, item.Flag) + if item.Flag&(1<<0) != 0 { + w = item.Head.WriteBoxed(w) + } + if item.Flag&(1<<0) != 0 { + w = item.Tail.Write(w) + } + return w +} + +func (item *ListService5Output) ReadBoxed(w []byte) (_ []byte, err error) { + if w, err = basictl.NatReadExactTag(w, 0x02d80cdd); err != nil { + return w, err + } + return item.Read(w) +} + +// This method is general version of WriteBoxed, use it instead! +func (item *ListService5Output) WriteBoxedGeneral(w []byte) (_ []byte, err error) { + return item.WriteBoxed(w), nil +} + +func (item *ListService5Output) WriteBoxed(w []byte) []byte { + w = basictl.NatWrite(w, 0x02d80cdd) + return item.Write(w) +} + +func (item ListService5Output) String() string { + return string(item.WriteJSON(nil)) +} + +func (item *ListService5Output) ReadJSON(legacyTypeNames bool, in *basictl.JsonLexer) error { + var propFlagPresented bool + var propHeadPresented bool + var propTailPresented bool + + if in != nil { + in.Delim('{') + if !in.Ok() { + return in.Error() + } + for !in.IsDelim('}') { + key := in.UnsafeFieldName(true) + in.WantColon() + switch key { + case "flag": + if propFlagPresented { + return internal.ErrorInvalidJSONWithDuplicatingKeys("list", "flag") + } + if err := internal.Json2ReadUint32(in, &item.Flag); err != nil { + return err + } + propFlagPresented = true + case "head": + if propHeadPresented { + return internal.ErrorInvalidJSONWithDuplicatingKeys("list", "head") + } + if err := item.Head.ReadJSON(legacyTypeNames, in); err != nil { + return err + } + propHeadPresented = true + case "tail": + if propTailPresented { + return internal.ErrorInvalidJSONWithDuplicatingKeys("list", "tail") + } + if item.Tail == nil { + var value ListService5Output + item.Tail = &value + } + if err := item.Tail.ReadJSON(legacyTypeNames, in); err != nil { + return err + } + propTailPresented = true + default: + return internal.ErrorInvalidJSONExcessElement("list", key) + } + in.WantComma() + } + in.Delim('}') + if !in.Ok() { + return in.Error() + } + } + if !propFlagPresented { + item.Flag = 0 + } + if !propHeadPresented { + item.Head.Reset() + } + if !propTailPresented { + if item.Tail != nil { + item.Tail.Reset() + } + } + if propHeadPresented { + item.Flag |= 1 << 0 + } + if propTailPresented { + item.Flag |= 1 << 0 + } + return nil +} + +// This method is general version of WriteJSON, use it instead! +func (item *ListService5Output) WriteJSONGeneral(w []byte) (_ []byte, err error) { + return item.WriteJSONOpt(true, false, w), nil +} + +func (item *ListService5Output) WriteJSON(w []byte) []byte { + return item.WriteJSONOpt(true, false, w) +} +func (item *ListService5Output) WriteJSONOpt(newTypeNames bool, short bool, w []byte) []byte { + w = append(w, '{') + backupIndexFlag := len(w) + w = basictl.JSONAddCommaIfNeeded(w) + w = append(w, `"flag":`...) + w = basictl.JSONWriteUint32(w, item.Flag) + if (item.Flag != 0) == false { + w = w[:backupIndexFlag] + } + if item.Flag&(1<<0) != 0 { + w = basictl.JSONAddCommaIfNeeded(w) + w = append(w, `"head":`...) + w = item.Head.WriteJSONOpt(newTypeNames, short, w) + } + if item.Flag&(1<<0) != 0 { + w = basictl.JSONAddCommaIfNeeded(w) + w = append(w, `"tail":`...) + w = item.Tail.WriteJSONOpt(newTypeNames, short, w) + } + return append(w, '}') +} + +func (item *ListService5Output) MarshalJSON() ([]byte, error) { + return item.WriteJSON(nil), nil +} + +func (item *ListService5Output) UnmarshalJSON(b []byte) error { + if err := item.ReadJSON(true, &basictl.JsonLexer{Data: b}); err != nil { + return internal.ErrorInvalidJSON("list", err.Error()) + } + return nil +} diff --git a/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall10/ab.call10.go b/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall10/ab.call10.go new file mode 100644 index 00000000..a3159316 --- /dev/null +++ b/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall10/ab.call10.go @@ -0,0 +1,153 @@ +// Copyright 2022 V Kontakte LLC +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +// Code generated by vktl/cmd/tlgen2; DO NOT EDIT. +package tlAbCall10 + +import ( + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tla/tlAColor" + "github.com/vkcom/tl/pkg/basictl" +) + +var _ = basictl.NatWrite +var _ = internal.ErrorInvalidEnumTag + +type AbCall10 struct { +} + +func (AbCall10) TLName() string { return "ab.call10" } +func (AbCall10) TLTag() uint32 { return 0x8db2a4f8 } + +func (item *AbCall10) Reset() {} + +func (item *AbCall10) FillRandom(rg *basictl.RandGenerator) {} + +func (item *AbCall10) Read(w []byte) (_ []byte, err error) { return w, nil } + +// This method is general version of Write, use it instead! +func (item *AbCall10) WriteGeneral(w []byte) (_ []byte, err error) { + return item.Write(w), nil +} + +func (item *AbCall10) Write(w []byte) []byte { + return w +} + +func (item *AbCall10) ReadBoxed(w []byte) (_ []byte, err error) { + if w, err = basictl.NatReadExactTag(w, 0x8db2a4f8); err != nil { + return w, err + } + return item.Read(w) +} + +// This method is general version of WriteBoxed, use it instead! +func (item *AbCall10) WriteBoxedGeneral(w []byte) (_ []byte, err error) { + return item.WriteBoxed(w), nil +} + +func (item *AbCall10) WriteBoxed(w []byte) []byte { + w = basictl.NatWrite(w, 0x8db2a4f8) + return item.Write(w) +} + +func (item *AbCall10) ReadResult(w []byte, ret *tlAColor.AColor) (_ []byte, err error) { + return ret.ReadBoxed(w) +} + +func (item *AbCall10) WriteResult(w []byte, ret tlAColor.AColor) (_ []byte, err error) { + w = ret.WriteBoxed(w) + return w, nil +} + +func (item *AbCall10) ReadResultJSON(legacyTypeNames bool, in *basictl.JsonLexer, ret *tlAColor.AColor) error { + if err := ret.ReadJSON(legacyTypeNames, in); err != nil { + return err + } + return nil +} + +func (item *AbCall10) WriteResultJSON(w []byte, ret tlAColor.AColor) (_ []byte, err error) { + return item.writeResultJSON(true, false, w, ret) +} + +func (item *AbCall10) writeResultJSON(newTypeNames bool, short bool, w []byte, ret tlAColor.AColor) (_ []byte, err error) { + w = ret.WriteJSONOpt(newTypeNames, short, w) + return w, nil +} + +func (item *AbCall10) ReadResultWriteResultJSON(r []byte, w []byte) (_ []byte, _ []byte, err error) { + var ret tlAColor.AColor + if r, err = item.ReadResult(r, &ret); err != nil { + return r, w, err + } + w, err = item.WriteResultJSON(w, ret) + return r, w, err +} + +func (item *AbCall10) ReadResultWriteResultJSONOpt(newTypeNames bool, short bool, r []byte, w []byte) (_ []byte, _ []byte, err error) { + var ret tlAColor.AColor + if r, err = item.ReadResult(r, &ret); err != nil { + return r, w, err + } + w, err = item.writeResultJSON(newTypeNames, short, w, ret) + return r, w, err +} + +func (item *AbCall10) ReadResultJSONWriteResult(r []byte, w []byte) ([]byte, []byte, error) { + var ret tlAColor.AColor + err := item.ReadResultJSON(true, &basictl.JsonLexer{Data: r}, &ret) + if err != nil { + return r, w, err + } + w, err = item.WriteResult(w, ret) + return r, w, err +} + +func (item AbCall10) String() string { + return string(item.WriteJSON(nil)) +} + +func (item *AbCall10) ReadJSON(legacyTypeNames bool, in *basictl.JsonLexer) error { + if in != nil { + in.Delim('{') + if !in.Ok() { + return in.Error() + } + for !in.IsDelim('}') { + return internal.ErrorInvalidJSON("ab.call10", "this object can't have properties") + } + in.Delim('}') + if !in.Ok() { + return in.Error() + } + } + return nil +} + +// This method is general version of WriteJSON, use it instead! +func (item *AbCall10) WriteJSONGeneral(w []byte) (_ []byte, err error) { + return item.WriteJSONOpt(true, false, w), nil +} + +func (item *AbCall10) WriteJSON(w []byte) []byte { + return item.WriteJSONOpt(true, false, w) +} +func (item *AbCall10) WriteJSONOpt(newTypeNames bool, short bool, w []byte) []byte { + w = append(w, '{') + return append(w, '}') +} + +func (item *AbCall10) MarshalJSON() ([]byte, error) { + return item.WriteJSON(nil), nil +} + +func (item *AbCall10) UnmarshalJSON(b []byte) error { + if err := item.ReadJSON(true, &basictl.JsonLexer{Data: b}); err != nil { + return internal.ErrorInvalidJSON("ab.call10", err.Error()) + } + return nil +} diff --git a/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall11/ab.call11.go b/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall11/ab.call11.go new file mode 100644 index 00000000..9b23be97 --- /dev/null +++ b/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall11/ab.call11.go @@ -0,0 +1,183 @@ +// Copyright 2022 V Kontakte LLC +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +// Code generated by vktl/cmd/tlgen2; DO NOT EDIT. +package tlAbCall11 + +import ( + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tla/tlAColor" + "github.com/vkcom/tl/pkg/basictl" +) + +var _ = basictl.NatWrite +var _ = internal.ErrorInvalidEnumTag + +type AbCall11 struct { + X tlAColor.AColor +} + +func (AbCall11) TLName() string { return "ab.call11" } +func (AbCall11) TLTag() uint32 { return 0xecb2a36c } + +func (item *AbCall11) Reset() { + item.X.Reset() +} + +func (item *AbCall11) FillRandom(rg *basictl.RandGenerator) { + item.X.FillRandom(rg) +} + +func (item *AbCall11) Read(w []byte) (_ []byte, err error) { + return item.X.ReadBoxed(w) +} + +// This method is general version of Write, use it instead! +func (item *AbCall11) WriteGeneral(w []byte) (_ []byte, err error) { + return item.Write(w), nil +} + +func (item *AbCall11) Write(w []byte) []byte { + w = item.X.WriteBoxed(w) + return w +} + +func (item *AbCall11) ReadBoxed(w []byte) (_ []byte, err error) { + if w, err = basictl.NatReadExactTag(w, 0xecb2a36c); err != nil { + return w, err + } + return item.Read(w) +} + +// This method is general version of WriteBoxed, use it instead! +func (item *AbCall11) WriteBoxedGeneral(w []byte) (_ []byte, err error) { + return item.WriteBoxed(w), nil +} + +func (item *AbCall11) WriteBoxed(w []byte) []byte { + w = basictl.NatWrite(w, 0xecb2a36c) + return item.Write(w) +} + +func (item *AbCall11) ReadResult(w []byte, ret *tlAColor.AColor) (_ []byte, err error) { + return ret.ReadBoxed(w) +} + +func (item *AbCall11) WriteResult(w []byte, ret tlAColor.AColor) (_ []byte, err error) { + w = ret.WriteBoxed(w) + return w, nil +} + +func (item *AbCall11) ReadResultJSON(legacyTypeNames bool, in *basictl.JsonLexer, ret *tlAColor.AColor) error { + if err := ret.ReadJSON(legacyTypeNames, in); err != nil { + return err + } + return nil +} + +func (item *AbCall11) WriteResultJSON(w []byte, ret tlAColor.AColor) (_ []byte, err error) { + return item.writeResultJSON(true, false, w, ret) +} + +func (item *AbCall11) writeResultJSON(newTypeNames bool, short bool, w []byte, ret tlAColor.AColor) (_ []byte, err error) { + w = ret.WriteJSONOpt(newTypeNames, short, w) + return w, nil +} + +func (item *AbCall11) ReadResultWriteResultJSON(r []byte, w []byte) (_ []byte, _ []byte, err error) { + var ret tlAColor.AColor + if r, err = item.ReadResult(r, &ret); err != nil { + return r, w, err + } + w, err = item.WriteResultJSON(w, ret) + return r, w, err +} + +func (item *AbCall11) ReadResultWriteResultJSONOpt(newTypeNames bool, short bool, r []byte, w []byte) (_ []byte, _ []byte, err error) { + var ret tlAColor.AColor + if r, err = item.ReadResult(r, &ret); err != nil { + return r, w, err + } + w, err = item.writeResultJSON(newTypeNames, short, w, ret) + return r, w, err +} + +func (item *AbCall11) ReadResultJSONWriteResult(r []byte, w []byte) ([]byte, []byte, error) { + var ret tlAColor.AColor + err := item.ReadResultJSON(true, &basictl.JsonLexer{Data: r}, &ret) + if err != nil { + return r, w, err + } + w, err = item.WriteResult(w, ret) + return r, w, err +} + +func (item AbCall11) String() string { + return string(item.WriteJSON(nil)) +} + +func (item *AbCall11) ReadJSON(legacyTypeNames bool, in *basictl.JsonLexer) error { + var propXPresented bool + + if in != nil { + in.Delim('{') + if !in.Ok() { + return in.Error() + } + for !in.IsDelim('}') { + key := in.UnsafeFieldName(true) + in.WantColon() + switch key { + case "x": + if propXPresented { + return internal.ErrorInvalidJSONWithDuplicatingKeys("ab.call11", "x") + } + if err := item.X.ReadJSON(legacyTypeNames, in); err != nil { + return err + } + propXPresented = true + default: + return internal.ErrorInvalidJSONExcessElement("ab.call11", key) + } + in.WantComma() + } + in.Delim('}') + if !in.Ok() { + return in.Error() + } + } + if !propXPresented { + item.X.Reset() + } + return nil +} + +// This method is general version of WriteJSON, use it instead! +func (item *AbCall11) WriteJSONGeneral(w []byte) (_ []byte, err error) { + return item.WriteJSONOpt(true, false, w), nil +} + +func (item *AbCall11) WriteJSON(w []byte) []byte { + return item.WriteJSONOpt(true, false, w) +} +func (item *AbCall11) WriteJSONOpt(newTypeNames bool, short bool, w []byte) []byte { + w = append(w, '{') + w = basictl.JSONAddCommaIfNeeded(w) + w = append(w, `"x":`...) + w = item.X.WriteJSONOpt(newTypeNames, short, w) + return append(w, '}') +} + +func (item *AbCall11) MarshalJSON() ([]byte, error) { + return item.WriteJSON(nil), nil +} + +func (item *AbCall11) UnmarshalJSON(b []byte) error { + if err := item.ReadJSON(true, &basictl.JsonLexer{Data: b}); err != nil { + return internal.ErrorInvalidJSON("ab.call11", err.Error()) + } + return nil +} diff --git a/internal/tlcodegen/test/gen/goldmaster/internal/tlservice5/tlService5InsertList/service5.insertList.go b/internal/tlcodegen/test/gen/goldmaster/internal/tlservice5/tlService5InsertList/service5.insertList.go new file mode 100644 index 00000000..da041a69 --- /dev/null +++ b/internal/tlcodegen/test/gen/goldmaster/internal/tlservice5/tlService5InsertList/service5.insertList.go @@ -0,0 +1,228 @@ +// Copyright 2022 V Kontakte LLC +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +// Code generated by vktl/cmd/tlgen2; DO NOT EDIT. +package tlService5InsertList + +import ( + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlListService5Output" + "github.com/vkcom/tl/pkg/basictl" +) + +var _ = basictl.NatWrite +var _ = internal.ErrorInvalidEnumTag + +type Service5InsertList struct { + Flags uint32 + // Persistent (TrueType) // Conditional: item.Flags.0 +} + +func (Service5InsertList) TLName() string { return "service5.insertList" } +func (Service5InsertList) TLTag() uint32 { return 0x7cf362bc } + +func (item *Service5InsertList) SetPersistent(v bool) { + if v { + item.Flags |= 1 << 0 + } else { + item.Flags &^= 1 << 0 + } +} +func (item Service5InsertList) IsSetPersistent() bool { return item.Flags&(1<<0) != 0 } + +func (item *Service5InsertList) Reset() { + item.Flags = 0 +} + +func (item *Service5InsertList) FillRandom(rg *basictl.RandGenerator) { + var maskFlags uint32 + maskFlags = basictl.RandomUint(rg) + item.Flags = 0 + if maskFlags&(1<<0) != 0 { + item.Flags |= (1 << 0) + } +} + +func (item *Service5InsertList) Read(w []byte) (_ []byte, err error) { + if w, err = basictl.NatRead(w, &item.Flags); err != nil { + return w, err + } + return w, nil +} + +// This method is general version of Write, use it instead! +func (item *Service5InsertList) WriteGeneral(w []byte) (_ []byte, err error) { + return item.Write(w), nil +} + +func (item *Service5InsertList) Write(w []byte) []byte { + w = basictl.NatWrite(w, item.Flags) + return w +} + +func (item *Service5InsertList) ReadBoxed(w []byte) (_ []byte, err error) { + if w, err = basictl.NatReadExactTag(w, 0x7cf362bc); err != nil { + return w, err + } + return item.Read(w) +} + +// This method is general version of WriteBoxed, use it instead! +func (item *Service5InsertList) WriteBoxedGeneral(w []byte) (_ []byte, err error) { + return item.WriteBoxed(w), nil +} + +func (item *Service5InsertList) WriteBoxed(w []byte) []byte { + w = basictl.NatWrite(w, 0x7cf362bc) + return item.Write(w) +} + +func (item *Service5InsertList) ReadResult(w []byte, ret *tlListService5Output.ListService5Output) (_ []byte, err error) { + return ret.ReadBoxed(w) +} + +func (item *Service5InsertList) WriteResult(w []byte, ret tlListService5Output.ListService5Output) (_ []byte, err error) { + w = ret.WriteBoxed(w) + return w, nil +} + +func (item *Service5InsertList) ReadResultJSON(legacyTypeNames bool, in *basictl.JsonLexer, ret *tlListService5Output.ListService5Output) error { + if err := ret.ReadJSON(legacyTypeNames, in); err != nil { + return err + } + return nil +} + +func (item *Service5InsertList) WriteResultJSON(w []byte, ret tlListService5Output.ListService5Output) (_ []byte, err error) { + return item.writeResultJSON(true, false, w, ret) +} + +func (item *Service5InsertList) writeResultJSON(newTypeNames bool, short bool, w []byte, ret tlListService5Output.ListService5Output) (_ []byte, err error) { + w = ret.WriteJSONOpt(newTypeNames, short, w) + return w, nil +} + +func (item *Service5InsertList) ReadResultWriteResultJSON(r []byte, w []byte) (_ []byte, _ []byte, err error) { + var ret tlListService5Output.ListService5Output + if r, err = item.ReadResult(r, &ret); err != nil { + return r, w, err + } + w, err = item.WriteResultJSON(w, ret) + return r, w, err +} + +func (item *Service5InsertList) ReadResultWriteResultJSONOpt(newTypeNames bool, short bool, r []byte, w []byte) (_ []byte, _ []byte, err error) { + var ret tlListService5Output.ListService5Output + if r, err = item.ReadResult(r, &ret); err != nil { + return r, w, err + } + w, err = item.writeResultJSON(newTypeNames, short, w, ret) + return r, w, err +} + +func (item *Service5InsertList) ReadResultJSONWriteResult(r []byte, w []byte) ([]byte, []byte, error) { + var ret tlListService5Output.ListService5Output + err := item.ReadResultJSON(true, &basictl.JsonLexer{Data: r}, &ret) + if err != nil { + return r, w, err + } + w, err = item.WriteResult(w, ret) + return r, w, err +} + +func (item Service5InsertList) String() string { + return string(item.WriteJSON(nil)) +} + +func (item *Service5InsertList) ReadJSON(legacyTypeNames bool, in *basictl.JsonLexer) error { + var propFlagsPresented bool + var trueTypePersistentPresented bool + var trueTypePersistentValue bool + + if in != nil { + in.Delim('{') + if !in.Ok() { + return in.Error() + } + for !in.IsDelim('}') { + key := in.UnsafeFieldName(true) + in.WantColon() + switch key { + case "flags": + if propFlagsPresented { + return internal.ErrorInvalidJSONWithDuplicatingKeys("service5.insertList", "flags") + } + if err := internal.Json2ReadUint32(in, &item.Flags); err != nil { + return err + } + propFlagsPresented = true + case "persistent": + if trueTypePersistentPresented { + return internal.ErrorInvalidJSONWithDuplicatingKeys("service5.insertList", "persistent") + } + if err := internal.Json2ReadBool(in, &trueTypePersistentValue); err != nil { + return err + } + trueTypePersistentPresented = true + default: + return internal.ErrorInvalidJSONExcessElement("service5.insertList", key) + } + in.WantComma() + } + in.Delim('}') + if !in.Ok() { + return in.Error() + } + } + if !propFlagsPresented { + item.Flags = 0 + } + if trueTypePersistentPresented { + if trueTypePersistentValue { + item.Flags |= 1 << 0 + } + } + // tries to set bit to zero if it is 1 + if trueTypePersistentPresented && !trueTypePersistentValue && (item.Flags&(1<<0) != 0) { + return internal.ErrorInvalidJSON("service5.insertList", "fieldmask bit flags.0 is indefinite because of the contradictions in values") + } + return nil +} + +// This method is general version of WriteJSON, use it instead! +func (item *Service5InsertList) WriteJSONGeneral(w []byte) (_ []byte, err error) { + return item.WriteJSONOpt(true, false, w), nil +} + +func (item *Service5InsertList) WriteJSON(w []byte) []byte { + return item.WriteJSONOpt(true, false, w) +} +func (item *Service5InsertList) WriteJSONOpt(newTypeNames bool, short bool, w []byte) []byte { + w = append(w, '{') + backupIndexFlags := len(w) + w = basictl.JSONAddCommaIfNeeded(w) + w = append(w, `"flags":`...) + w = basictl.JSONWriteUint32(w, item.Flags) + if (item.Flags != 0) == false { + w = w[:backupIndexFlags] + } + if item.Flags&(1<<0) != 0 { + w = basictl.JSONAddCommaIfNeeded(w) + w = append(w, `"persistent":true`...) + } + return append(w, '}') +} + +func (item *Service5InsertList) MarshalJSON() ([]byte, error) { + return item.WriteJSON(nil), nil +} + +func (item *Service5InsertList) UnmarshalJSON(b []byte) error { + if err := item.ReadJSON(true, &basictl.JsonLexer{Data: b}); err != nil { + return internal.ErrorInvalidJSON("service5.insertList", err.Error()) + } + return nil +} diff --git a/internal/tlcodegen/test/gen/goldmaster/meta/meta.go b/internal/tlcodegen/test/gen/goldmaster/meta/meta.go index ff04033d..7375dbdb 100644 --- a/internal/tlcodegen/test/gen/goldmaster/meta/meta.go +++ b/internal/tlcodegen/test/gen/goldmaster/meta/meta.go @@ -129,9 +129,13 @@ func CreateObjectFromNameBytes(name string) Object { } type TLItem struct { - tag uint32 - annotations uint32 - tlName string + tag uint32 + annotations uint32 + tlName string + + resultTypeContainsUnionTypes bool + argumentsTypesContainUnionTypes bool + createFunction func() Function createFunctionLong func() Function createObject func() Object @@ -146,6 +150,9 @@ func (item TLItem) CreateObject() Object { return item.createObject() } func (item TLItem) IsFunction() bool { return item.createFunction != nil } func (item TLItem) CreateFunction() Function { return item.createFunction() } +func (item TLItem) HasUnionTypesInResult() bool { return item.resultTypeContainsUnionTypes } +func (item TLItem) HasUnionTypesInArguments() bool { return item.argumentsTypesContainUnionTypes } + // For transcoding short-long version during Long ID transition func (item TLItem) HasFunctionLong() bool { return item.createFunctionLong != nil } func (item TLItem) CreateFunctionLong() Function { return item.createFunctionLong() } @@ -298,107 +305,110 @@ func fillFunction(n1 string, n2 string, item *TLItem) { } func init() { - fillObject("a.blue#623360f3", "#623360f3", &TLItem{tag: 0x623360f3, annotations: 0x0, tlName: "a.blue"}) - fillObject("a.color#f35d7a69", "#f35d7a69", &TLItem{tag: 0xf35d7a69, annotations: 0x0, tlName: "a.color"}) - fillObject("a.green#6127e7b8", "#6127e7b8", &TLItem{tag: 0x6127e7b8, annotations: 0x0, tlName: "a.green"}) - fillObject("a.red#b83a723d", "#b83a723d", &TLItem{tag: 0xb83a723d, annotations: 0x0, tlName: "a.red"}) - fillObject("a.top2#7082d18f", "#7082d18f", &TLItem{tag: 0x7082d18f, annotations: 0x0, tlName: "a.top2"}) - fillObject("a.uNionA#a7662843", "#a7662843", &TLItem{tag: 0xa7662843, annotations: 0x0, tlName: "a.uNionA"}) - fillObject("ab.alias#944aaa97", "#944aaa97", &TLItem{tag: 0x944aaa97, annotations: 0x0, tlName: "ab.alias"}) - fillFunction("ab.call1#20c5fb2d", "#20c5fb2d", &TLItem{tag: 0x20c5fb2d, annotations: 0x1, tlName: "ab.call1"}) - fillFunction("ab.call2#77d5f057", "#77d5f057", &TLItem{tag: 0x77d5f057, annotations: 0x1, tlName: "ab.call2"}) - fillFunction("ab.call3#0a083445", "#0a083445", &TLItem{tag: 0x0a083445, annotations: 0x1, tlName: "ab.call3"}) - fillFunction("ab.call4#c1220a1e", "#c1220a1e", &TLItem{tag: 0xc1220a1e, annotations: 0x1, tlName: "ab.call4"}) - fillFunction("ab.call5#7ba4d28d", "#7ba4d28d", &TLItem{tag: 0x7ba4d28d, annotations: 0x1, tlName: "ab.call5"}) - fillFunction("ab.call6#84d815cb", "#84d815cb", &TLItem{tag: 0x84d815cb, annotations: 0x1, tlName: "ab.call6"}) - fillFunction("ab.call7#46ec10bf", "#46ec10bf", &TLItem{tag: 0x46ec10bf, annotations: 0x1, tlName: "ab.call7"}) - fillFunction("ab.call8#1b8652d9", "#1b8652d9", &TLItem{tag: 0x1b8652d9, annotations: 0x1, tlName: "ab.call8"}) - fillFunction("ab.call9#75de906c", "#75de906c", &TLItem{tag: 0x75de906c, annotations: 0x1, tlName: "ab.call9"}) - fillObject("ab.code#7651b1ac", "#7651b1ac", &TLItem{tag: 0x7651b1ac, annotations: 0x0, tlName: "ab.code"}) - fillObject("ab.counterChangeRequestPeriodsMany#14a35d80", "#14a35d80", &TLItem{tag: 0x14a35d80, annotations: 0x0, tlName: "ab.counterChangeRequestPeriodsMany"}) - fillObject("ab.counterChangeRequestPeriodsOne#d9c36de5", "#d9c36de5", &TLItem{tag: 0xd9c36de5, annotations: 0x0, tlName: "ab.counterChangeRequestPeriodsOne"}) - fillObject("ab.empty#1ec6a63e", "#1ec6a63e", &TLItem{tag: 0x1ec6a63e, annotations: 0x0, tlName: "ab.empty"}) - fillObject("ab.myType#e0e96c86", "#e0e96c86", &TLItem{tag: 0xe0e96c86, annotations: 0x0, tlName: "ab.myType"}) - fillObject("ab.testMaybe#4dac492a", "#4dac492a", &TLItem{tag: 0x4dac492a, annotations: 0x0, tlName: "ab.testMaybe"}) - fillObject("ab.topLevel1#e67bce28", "#e67bce28", &TLItem{tag: 0xe67bce28, annotations: 0x0, tlName: "ab.topLevel1"}) - fillObject("ab.topLevel2#cef933fb", "#cef933fb", &TLItem{tag: 0xcef933fb, annotations: 0x0, tlName: "ab.topLevel2"}) - fillObject("ab.typeA#a99fef6a", "#a99fef6a", &TLItem{tag: 0xa99fef6a, annotations: 0x0, tlName: "ab.typeA"}) - fillObject("ab.typeB#ff2e6d58", "#ff2e6d58", &TLItem{tag: 0xff2e6d58, annotations: 0x0, tlName: "ab.typeB"}) - fillObject("ab.typeC#69920d6e", "#69920d6e", &TLItem{tag: 0x69920d6e, annotations: 0x0, tlName: "ab.typeC"}) - fillObject("ab.typeD#76615bf1", "#76615bf1", &TLItem{tag: 0x76615bf1, annotations: 0x0, tlName: "ab.typeD"}) - fillObject("ab.useCycle#71687381", "#71687381", &TLItem{tag: 0x71687381, annotations: 0x0, tlName: "ab.useCycle"}) - fillObject("ab.useDictString#3325d884", "#3325d884", &TLItem{tag: 0x3325d884, annotations: 0x0, tlName: "ab.useDictString"}) - fillObject("au.nionA#df61f632", "#df61f632", &TLItem{tag: 0xdf61f632, annotations: 0x0, tlName: "au.nionA"}) - fillObject("b.red#a9471844", "#a9471844", &TLItem{tag: 0xa9471844, annotations: 0x0, tlName: "b.red"}) - fillFunction("call1#a7302fbc", "#a7302fbc", &TLItem{tag: 0xa7302fbc, annotations: 0x1, tlName: "call1"}) - fillFunction("call2#f02024c6", "#f02024c6", &TLItem{tag: 0xf02024c6, annotations: 0x1, tlName: "call2"}) - fillFunction("call3#6ace6718", "#6ace6718", &TLItem{tag: 0x6ace6718, annotations: 0x1, tlName: "call3"}) - fillFunction("call4#46d7de8f", "#46d7de8f", &TLItem{tag: 0x46d7de8f, annotations: 0x1, tlName: "call4"}) - fillFunction("call5#fc51061c", "#fc51061c", &TLItem{tag: 0xfc51061c, annotations: 0x1, tlName: "call5"}) - fillFunction("call6#e41e4696", "#e41e4696", &TLItem{tag: 0xe41e4696, annotations: 0x1, tlName: "call6"}) - fillFunction("call7#262a43e2", "#262a43e2", &TLItem{tag: 0x262a43e2, annotations: 0x1, tlName: "call7"}) - fillFunction("call8#7b400184", "#7b400184", &TLItem{tag: 0x7b400184, annotations: 0x1, tlName: "call8"}) - fillFunction("call9#67a0d62d", "#67a0d62d", &TLItem{tag: 0x67a0d62d, annotations: 0x1, tlName: "call9"}) - fillObject("cd.myType#eab6a6b4", "#eab6a6b4", &TLItem{tag: 0xeab6a6b4, annotations: 0x0, tlName: "cd.myType"}) - fillObject("cd.response#8c202f64", "#8c202f64", &TLItem{tag: 0x8c202f64, annotations: 0x0, tlName: "cd.response"}) - fillObject("cd.topLevel3#5cd1ca89", "#5cd1ca89", &TLItem{tag: 0x5cd1ca89, annotations: 0x0, tlName: "cd.topLevel3"}) - fillObject("cd.typeA#a831a920", "#a831a920", &TLItem{tag: 0xa831a920, annotations: 0x0, tlName: "cd.typeA"}) - fillObject("cd.typeB#377b4996", "#377b4996", &TLItem{tag: 0x377b4996, annotations: 0x0, tlName: "cd.typeB"}) - fillObject("cd.typeC#db0f93d4", "#db0f93d4", &TLItem{tag: 0xdb0f93d4, annotations: 0x0, tlName: "cd.typeC"}) - fillObject("cd.typeD#b5528285", "#b5528285", &TLItem{tag: 0xb5528285, annotations: 0x0, tlName: "cd.typeD"}) - fillObject("cd.useCycle#6ed67ca0", "#6ed67ca0", &TLItem{tag: 0x6ed67ca0, annotations: 0x0, tlName: "cd.useCycle"}) - fillObject("cyc1.myCycle#136ecc9e", "#136ecc9e", &TLItem{tag: 0x136ecc9e, annotations: 0x0, tlName: "cyc1.myCycle"}) - fillObject("cyc2.myCycle#fba5eecb", "#fba5eecb", &TLItem{tag: 0xfba5eecb, annotations: 0x0, tlName: "cyc2.myCycle"}) - fillObject("cyc3.myCycle#47866860", "#47866860", &TLItem{tag: 0x47866860, annotations: 0x0, tlName: "cyc3.myCycle"}) - fillObject("cycleTuple#c867fae3", "#c867fae3", &TLItem{tag: 0xc867fae3, annotations: 0x0, tlName: "cycleTuple"}) - fillObject("halfStr#647ddaf5", "#647ddaf5", &TLItem{tag: 0x647ddaf5, annotations: 0x0, tlName: "halfStr"}) - fillObject("hren#12ab5219", "#12ab5219", &TLItem{tag: 0x12ab5219, annotations: 0x0, tlName: "hren"}) - fillObject("int#a8509bda", "#a8509bda", &TLItem{tag: 0xa8509bda, annotations: 0x0, tlName: "int"}) - fillObject("int32#7934e71f", "#7934e71f", &TLItem{tag: 0x7934e71f, annotations: 0x0, tlName: "int32"}) - fillObject("int64#f5609de0", "#f5609de0", &TLItem{tag: 0xf5609de0, annotations: 0x0, tlName: "int64"}) - fillObject("long#22076cba", "#22076cba", &TLItem{tag: 0x22076cba, annotations: 0x0, tlName: "long"}) - fillObject("maybeTest1#c457763c", "#c457763c", &TLItem{tag: 0xc457763c, annotations: 0x0, tlName: "maybeTest1"}) - fillObject("multiPoint#0e1ae81e", "#0e1ae81e", &TLItem{tag: 0x0e1ae81e, annotations: 0x0, tlName: "multiPoint"}) - fillObject("myInt32#ba59e151", "#ba59e151", &TLItem{tag: 0xba59e151, annotations: 0x0, tlName: "myInt32"}) - fillObject("myInt64#1d95db9d", "#1d95db9d", &TLItem{tag: 0x1d95db9d, annotations: 0x0, tlName: "myInt64"}) - fillObject("myNat#c60c1b41", "#c60c1b41", &TLItem{tag: 0xc60c1b41, annotations: 0x0, tlName: "myNat"}) - fillObject("myPlus#79e0c6df", "#79e0c6df", &TLItem{tag: 0x79e0c6df, annotations: 0x0, tlName: "myPlus"}) - fillObject("myPlus3#692c291b", "#692c291b", &TLItem{tag: 0x692c291b, annotations: 0x0, tlName: "myPlus3"}) - fillObject("myZero#8d868379", "#8d868379", &TLItem{tag: 0x8d868379, annotations: 0x0, tlName: "myZero"}) - fillObject("myZero3#103a40cf", "#103a40cf", &TLItem{tag: 0x103a40cf, annotations: 0x0, tlName: "myZero3"}) - fillObject("nativeWrappers#344ddf50", "#344ddf50", &TLItem{tag: 0x344ddf50, annotations: 0x0, tlName: "nativeWrappers"}) - fillObject("noStr#3a728324", "#3a728324", &TLItem{tag: 0x3a728324, annotations: 0x0, tlName: "noStr"}) - fillObject("replace#323db63e", "#323db63e", &TLItem{tag: 0x323db63e, annotations: 0x0, tlName: "replace"}) - fillObject("replace10#fc81f008", "#fc81f008", &TLItem{tag: 0xfc81f008, annotations: 0x0, tlName: "replace10"}) - fillObject("replace12#ec121094", "#ec121094", &TLItem{tag: 0xec121094, annotations: 0x0, tlName: "replace12"}) - fillObject("replace15#2280e430", "#2280e430", &TLItem{tag: 0x2280e430, annotations: 0x0, tlName: "replace15"}) - fillObject("replace17#f46f9b9b", "#f46f9b9b", &TLItem{tag: 0xf46f9b9b, annotations: 0x0, tlName: "replace17"}) - fillObject("replace18#704dd712", "#704dd712", &TLItem{tag: 0x704dd712, annotations: 0x0, tlName: "replace18"}) - fillObject("replace2#e2d4ebee", "#e2d4ebee", &TLItem{tag: 0xe2d4ebee, annotations: 0x0, tlName: "replace2"}) - fillObject("replace3#51e324e4", "#51e324e4", &TLItem{tag: 0x51e324e4, annotations: 0x0, tlName: "replace3"}) - fillObject("replace5#8b5bc78a", "#8b5bc78a", &TLItem{tag: 0x8b5bc78a, annotations: 0x0, tlName: "replace5"}) - fillObject("replace6#abd49d06", "#abd49d06", &TLItem{tag: 0xabd49d06, annotations: 0x0, tlName: "replace6"}) - fillObject("replace7#f4c66d9f", "#f4c66d9f", &TLItem{tag: 0xf4c66d9f, annotations: 0x0, tlName: "replace7"}) - fillObject("replace8#d626c117", "#d626c117", &TLItem{tag: 0xd626c117, annotations: 0x0, tlName: "replace8"}) - fillObject("replace9#95d598c5", "#95d598c5", &TLItem{tag: 0x95d598c5, annotations: 0x0, tlName: "replace9"}) - fillObject("service5.emptyOutput#ff8f7db8", "#ff8f7db8", &TLItem{tag: 0xff8f7db8, annotations: 0x0, tlName: "service5.emptyOutput"}) - fillFunction("service5.insert#7cf362ba", "#7cf362ba", &TLItem{tag: 0x7cf362ba, annotations: 0x2, tlName: "service5.insert"}) - fillObject("service5Long.emptyOutput#ff8f7db9", "#ff8f7db9", &TLItem{tag: 0xff8f7db9, annotations: 0x0, tlName: "service5Long.emptyOutput"}) - fillFunction("service5Long.insert#7cf362bb", "#7cf362bb", &TLItem{tag: 0x7cf362bb, annotations: 0x2, tlName: "service5Long.insert"}) - fillObject("service5Long.stringOutput#dc170ff5", "#dc170ff5", &TLItem{tag: 0xdc170ff5, annotations: 0x0, tlName: "service5Long.stringOutput"}) - fillObject("service5.stringOutput#dc170ff4", "#dc170ff4", &TLItem{tag: 0xdc170ff4, annotations: 0x0, tlName: "service5.stringOutput"}) - fillObject("string#b5286e24", "#b5286e24", &TLItem{tag: 0xb5286e24, annotations: 0x0, tlName: "string"}) - fillObject("testMaybe#88920e90", "#88920e90", &TLItem{tag: 0x88920e90, annotations: 0x0, tlName: "testMaybe"}) - fillObject("testMaybe2#0aa03cf2", "#0aa03cf2", &TLItem{tag: 0x0aa03cf2, annotations: 0x0, tlName: "testMaybe2"}) - fillObject("true#3fedd339", "#3fedd339", &TLItem{tag: 0x3fedd339, annotations: 0x0, tlName: "true"}) - fillObject("typeA#157673c1", "#157673c1", &TLItem{tag: 0x157673c1, annotations: 0x0, tlName: "typeA"}) - fillObject("typeB#9d024802", "#9d024802", &TLItem{tag: 0x9d024802, annotations: 0x0, tlName: "typeB"}) - fillObject("typeC#6b8ef43f", "#6b8ef43f", &TLItem{tag: 0x6b8ef43f, annotations: 0x0, tlName: "typeC"}) - fillObject("typeD#b1f4369e", "#b1f4369e", &TLItem{tag: 0xb1f4369e, annotations: 0x0, tlName: "typeD"}) - fillObject("unionArgsUse#742161d2", "#742161d2", &TLItem{tag: 0x742161d2, annotations: 0x0, tlName: "unionArgsUse"}) - fillObject("useDictUgly#fb9ce817", "#fb9ce817", &TLItem{tag: 0xfb9ce817, annotations: 0x0, tlName: "useDictUgly"}) - fillObject("useResponse#0a63ec5f", "#0a63ec5f", &TLItem{tag: 0x0a63ec5f, annotations: 0x0, tlName: "useResponse"}) - fillObject("useStr#9aa3dee5", "#9aa3dee5", &TLItem{tag: 0x9aa3dee5, annotations: 0x0, tlName: "useStr"}) - fillObject("useTrue#dfdd4180", "#dfdd4180", &TLItem{tag: 0xdfdd4180, annotations: 0x0, tlName: "useTrue"}) - fillFunction("usefulService.getUserEntity#3c857e52", "#3c857e52", &TLItem{tag: 0x3c857e52, annotations: 0x2, tlName: "usefulService.getUserEntity"}) + fillObject("a.blue#623360f3", "#623360f3", &TLItem{tag: 0x623360f3, annotations: 0x0, tlName: "a.blue", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("a.color#f35d7a69", "#f35d7a69", &TLItem{tag: 0xf35d7a69, annotations: 0x0, tlName: "a.color", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("a.green#6127e7b8", "#6127e7b8", &TLItem{tag: 0x6127e7b8, annotations: 0x0, tlName: "a.green", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("a.red#b83a723d", "#b83a723d", &TLItem{tag: 0xb83a723d, annotations: 0x0, tlName: "a.red", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("a.top2#7082d18f", "#7082d18f", &TLItem{tag: 0x7082d18f, annotations: 0x0, tlName: "a.top2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("a.uNionA#a7662843", "#a7662843", &TLItem{tag: 0xa7662843, annotations: 0x0, tlName: "a.uNionA", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.alias#944aaa97", "#944aaa97", &TLItem{tag: 0x944aaa97, annotations: 0x0, tlName: "ab.alias", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call1#20c5fb2d", "#20c5fb2d", &TLItem{tag: 0x20c5fb2d, annotations: 0x1, tlName: "ab.call1", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call10#8db2a4f8", "#8db2a4f8", &TLItem{tag: 0x8db2a4f8, annotations: 0x1, tlName: "ab.call10", resultTypeContainsUnionTypes: true, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call11#ecb2a36c", "#ecb2a36c", &TLItem{tag: 0xecb2a36c, annotations: 0x1, tlName: "ab.call11", resultTypeContainsUnionTypes: true, argumentsTypesContainUnionTypes: true}) + fillFunction("ab.call2#77d5f057", "#77d5f057", &TLItem{tag: 0x77d5f057, annotations: 0x1, tlName: "ab.call2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call3#0a083445", "#0a083445", &TLItem{tag: 0x0a083445, annotations: 0x1, tlName: "ab.call3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call4#c1220a1e", "#c1220a1e", &TLItem{tag: 0xc1220a1e, annotations: 0x1, tlName: "ab.call4", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call5#7ba4d28d", "#7ba4d28d", &TLItem{tag: 0x7ba4d28d, annotations: 0x1, tlName: "ab.call5", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call6#84d815cb", "#84d815cb", &TLItem{tag: 0x84d815cb, annotations: 0x1, tlName: "ab.call6", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call7#46ec10bf", "#46ec10bf", &TLItem{tag: 0x46ec10bf, annotations: 0x1, tlName: "ab.call7", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call8#1b8652d9", "#1b8652d9", &TLItem{tag: 0x1b8652d9, annotations: 0x1, tlName: "ab.call8", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call9#75de906c", "#75de906c", &TLItem{tag: 0x75de906c, annotations: 0x1, tlName: "ab.call9", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.code#7651b1ac", "#7651b1ac", &TLItem{tag: 0x7651b1ac, annotations: 0x0, tlName: "ab.code", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.counterChangeRequestPeriodsMany#14a35d80", "#14a35d80", &TLItem{tag: 0x14a35d80, annotations: 0x0, tlName: "ab.counterChangeRequestPeriodsMany", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.counterChangeRequestPeriodsOne#d9c36de5", "#d9c36de5", &TLItem{tag: 0xd9c36de5, annotations: 0x0, tlName: "ab.counterChangeRequestPeriodsOne", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.empty#1ec6a63e", "#1ec6a63e", &TLItem{tag: 0x1ec6a63e, annotations: 0x0, tlName: "ab.empty", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.myType#e0e96c86", "#e0e96c86", &TLItem{tag: 0xe0e96c86, annotations: 0x0, tlName: "ab.myType", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.testMaybe#4dac492a", "#4dac492a", &TLItem{tag: 0x4dac492a, annotations: 0x0, tlName: "ab.testMaybe", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.topLevel1#e67bce28", "#e67bce28", &TLItem{tag: 0xe67bce28, annotations: 0x0, tlName: "ab.topLevel1", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.topLevel2#cef933fb", "#cef933fb", &TLItem{tag: 0xcef933fb, annotations: 0x0, tlName: "ab.topLevel2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.typeA#a99fef6a", "#a99fef6a", &TLItem{tag: 0xa99fef6a, annotations: 0x0, tlName: "ab.typeA", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.typeB#ff2e6d58", "#ff2e6d58", &TLItem{tag: 0xff2e6d58, annotations: 0x0, tlName: "ab.typeB", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.typeC#69920d6e", "#69920d6e", &TLItem{tag: 0x69920d6e, annotations: 0x0, tlName: "ab.typeC", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.typeD#76615bf1", "#76615bf1", &TLItem{tag: 0x76615bf1, annotations: 0x0, tlName: "ab.typeD", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.useCycle#71687381", "#71687381", &TLItem{tag: 0x71687381, annotations: 0x0, tlName: "ab.useCycle", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.useDictString#3325d884", "#3325d884", &TLItem{tag: 0x3325d884, annotations: 0x0, tlName: "ab.useDictString", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("au.nionA#df61f632", "#df61f632", &TLItem{tag: 0xdf61f632, annotations: 0x0, tlName: "au.nionA", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("b.red#a9471844", "#a9471844", &TLItem{tag: 0xa9471844, annotations: 0x0, tlName: "b.red", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call1#a7302fbc", "#a7302fbc", &TLItem{tag: 0xa7302fbc, annotations: 0x1, tlName: "call1", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call2#f02024c6", "#f02024c6", &TLItem{tag: 0xf02024c6, annotations: 0x1, tlName: "call2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call3#6ace6718", "#6ace6718", &TLItem{tag: 0x6ace6718, annotations: 0x1, tlName: "call3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call4#46d7de8f", "#46d7de8f", &TLItem{tag: 0x46d7de8f, annotations: 0x1, tlName: "call4", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call5#fc51061c", "#fc51061c", &TLItem{tag: 0xfc51061c, annotations: 0x1, tlName: "call5", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call6#e41e4696", "#e41e4696", &TLItem{tag: 0xe41e4696, annotations: 0x1, tlName: "call6", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call7#262a43e2", "#262a43e2", &TLItem{tag: 0x262a43e2, annotations: 0x1, tlName: "call7", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call8#7b400184", "#7b400184", &TLItem{tag: 0x7b400184, annotations: 0x1, tlName: "call8", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call9#67a0d62d", "#67a0d62d", &TLItem{tag: 0x67a0d62d, annotations: 0x1, tlName: "call9", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.myType#eab6a6b4", "#eab6a6b4", &TLItem{tag: 0xeab6a6b4, annotations: 0x0, tlName: "cd.myType", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.response#8c202f64", "#8c202f64", &TLItem{tag: 0x8c202f64, annotations: 0x0, tlName: "cd.response", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.topLevel3#5cd1ca89", "#5cd1ca89", &TLItem{tag: 0x5cd1ca89, annotations: 0x0, tlName: "cd.topLevel3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.typeA#a831a920", "#a831a920", &TLItem{tag: 0xa831a920, annotations: 0x0, tlName: "cd.typeA", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.typeB#377b4996", "#377b4996", &TLItem{tag: 0x377b4996, annotations: 0x0, tlName: "cd.typeB", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.typeC#db0f93d4", "#db0f93d4", &TLItem{tag: 0xdb0f93d4, annotations: 0x0, tlName: "cd.typeC", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.typeD#b5528285", "#b5528285", &TLItem{tag: 0xb5528285, annotations: 0x0, tlName: "cd.typeD", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.useCycle#6ed67ca0", "#6ed67ca0", &TLItem{tag: 0x6ed67ca0, annotations: 0x0, tlName: "cd.useCycle", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cyc1.myCycle#136ecc9e", "#136ecc9e", &TLItem{tag: 0x136ecc9e, annotations: 0x0, tlName: "cyc1.myCycle", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cyc2.myCycle#fba5eecb", "#fba5eecb", &TLItem{tag: 0xfba5eecb, annotations: 0x0, tlName: "cyc2.myCycle", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cyc3.myCycle#47866860", "#47866860", &TLItem{tag: 0x47866860, annotations: 0x0, tlName: "cyc3.myCycle", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cycleTuple#c867fae3", "#c867fae3", &TLItem{tag: 0xc867fae3, annotations: 0x0, tlName: "cycleTuple", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("halfStr#647ddaf5", "#647ddaf5", &TLItem{tag: 0x647ddaf5, annotations: 0x0, tlName: "halfStr", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("hren#12ab5219", "#12ab5219", &TLItem{tag: 0x12ab5219, annotations: 0x0, tlName: "hren", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("int#a8509bda", "#a8509bda", &TLItem{tag: 0xa8509bda, annotations: 0x0, tlName: "int", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("int32#7934e71f", "#7934e71f", &TLItem{tag: 0x7934e71f, annotations: 0x0, tlName: "int32", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("int64#f5609de0", "#f5609de0", &TLItem{tag: 0xf5609de0, annotations: 0x0, tlName: "int64", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("long#22076cba", "#22076cba", &TLItem{tag: 0x22076cba, annotations: 0x0, tlName: "long", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("maybeTest1#c457763c", "#c457763c", &TLItem{tag: 0xc457763c, annotations: 0x0, tlName: "maybeTest1", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("multiPoint#0e1ae81e", "#0e1ae81e", &TLItem{tag: 0x0e1ae81e, annotations: 0x0, tlName: "multiPoint", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myInt32#ba59e151", "#ba59e151", &TLItem{tag: 0xba59e151, annotations: 0x0, tlName: "myInt32", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myInt64#1d95db9d", "#1d95db9d", &TLItem{tag: 0x1d95db9d, annotations: 0x0, tlName: "myInt64", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myNat#c60c1b41", "#c60c1b41", &TLItem{tag: 0xc60c1b41, annotations: 0x0, tlName: "myNat", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myPlus#79e0c6df", "#79e0c6df", &TLItem{tag: 0x79e0c6df, annotations: 0x0, tlName: "myPlus", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myPlus3#692c291b", "#692c291b", &TLItem{tag: 0x692c291b, annotations: 0x0, tlName: "myPlus3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myZero#8d868379", "#8d868379", &TLItem{tag: 0x8d868379, annotations: 0x0, tlName: "myZero", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myZero3#103a40cf", "#103a40cf", &TLItem{tag: 0x103a40cf, annotations: 0x0, tlName: "myZero3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("nativeWrappers#344ddf50", "#344ddf50", &TLItem{tag: 0x344ddf50, annotations: 0x0, tlName: "nativeWrappers", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("noStr#3a728324", "#3a728324", &TLItem{tag: 0x3a728324, annotations: 0x0, tlName: "noStr", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace#323db63e", "#323db63e", &TLItem{tag: 0x323db63e, annotations: 0x0, tlName: "replace", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace10#fc81f008", "#fc81f008", &TLItem{tag: 0xfc81f008, annotations: 0x0, tlName: "replace10", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace12#ec121094", "#ec121094", &TLItem{tag: 0xec121094, annotations: 0x0, tlName: "replace12", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace15#2280e430", "#2280e430", &TLItem{tag: 0x2280e430, annotations: 0x0, tlName: "replace15", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace17#f46f9b9b", "#f46f9b9b", &TLItem{tag: 0xf46f9b9b, annotations: 0x0, tlName: "replace17", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace18#704dd712", "#704dd712", &TLItem{tag: 0x704dd712, annotations: 0x0, tlName: "replace18", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace2#e2d4ebee", "#e2d4ebee", &TLItem{tag: 0xe2d4ebee, annotations: 0x0, tlName: "replace2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace3#51e324e4", "#51e324e4", &TLItem{tag: 0x51e324e4, annotations: 0x0, tlName: "replace3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace5#8b5bc78a", "#8b5bc78a", &TLItem{tag: 0x8b5bc78a, annotations: 0x0, tlName: "replace5", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace6#abd49d06", "#abd49d06", &TLItem{tag: 0xabd49d06, annotations: 0x0, tlName: "replace6", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace7#f4c66d9f", "#f4c66d9f", &TLItem{tag: 0xf4c66d9f, annotations: 0x0, tlName: "replace7", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace8#d626c117", "#d626c117", &TLItem{tag: 0xd626c117, annotations: 0x0, tlName: "replace8", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace9#95d598c5", "#95d598c5", &TLItem{tag: 0x95d598c5, annotations: 0x0, tlName: "replace9", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("service5.emptyOutput#ff8f7db8", "#ff8f7db8", &TLItem{tag: 0xff8f7db8, annotations: 0x0, tlName: "service5.emptyOutput", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("service5.insert#7cf362ba", "#7cf362ba", &TLItem{tag: 0x7cf362ba, annotations: 0x2, tlName: "service5.insert", resultTypeContainsUnionTypes: true, argumentsTypesContainUnionTypes: false}) + fillFunction("service5.insertList#7cf362bc", "#7cf362bc", &TLItem{tag: 0x7cf362bc, annotations: 0x2, tlName: "service5.insertList", resultTypeContainsUnionTypes: true, argumentsTypesContainUnionTypes: false}) + fillObject("service5Long.emptyOutput#ff8f7db9", "#ff8f7db9", &TLItem{tag: 0xff8f7db9, annotations: 0x0, tlName: "service5Long.emptyOutput", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("service5Long.insert#7cf362bb", "#7cf362bb", &TLItem{tag: 0x7cf362bb, annotations: 0x2, tlName: "service5Long.insert", resultTypeContainsUnionTypes: true, argumentsTypesContainUnionTypes: false}) + fillObject("service5Long.stringOutput#dc170ff5", "#dc170ff5", &TLItem{tag: 0xdc170ff5, annotations: 0x0, tlName: "service5Long.stringOutput", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("service5.stringOutput#dc170ff4", "#dc170ff4", &TLItem{tag: 0xdc170ff4, annotations: 0x0, tlName: "service5.stringOutput", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("string#b5286e24", "#b5286e24", &TLItem{tag: 0xb5286e24, annotations: 0x0, tlName: "string", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("testMaybe#88920e90", "#88920e90", &TLItem{tag: 0x88920e90, annotations: 0x0, tlName: "testMaybe", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("testMaybe2#0aa03cf2", "#0aa03cf2", &TLItem{tag: 0x0aa03cf2, annotations: 0x0, tlName: "testMaybe2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("true#3fedd339", "#3fedd339", &TLItem{tag: 0x3fedd339, annotations: 0x0, tlName: "true", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("typeA#157673c1", "#157673c1", &TLItem{tag: 0x157673c1, annotations: 0x0, tlName: "typeA", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("typeB#9d024802", "#9d024802", &TLItem{tag: 0x9d024802, annotations: 0x0, tlName: "typeB", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("typeC#6b8ef43f", "#6b8ef43f", &TLItem{tag: 0x6b8ef43f, annotations: 0x0, tlName: "typeC", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("typeD#b1f4369e", "#b1f4369e", &TLItem{tag: 0xb1f4369e, annotations: 0x0, tlName: "typeD", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("unionArgsUse#742161d2", "#742161d2", &TLItem{tag: 0x742161d2, annotations: 0x0, tlName: "unionArgsUse", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("useDictUgly#fb9ce817", "#fb9ce817", &TLItem{tag: 0xfb9ce817, annotations: 0x0, tlName: "useDictUgly", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("useResponse#0a63ec5f", "#0a63ec5f", &TLItem{tag: 0x0a63ec5f, annotations: 0x0, tlName: "useResponse", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("useStr#9aa3dee5", "#9aa3dee5", &TLItem{tag: 0x9aa3dee5, annotations: 0x0, tlName: "useStr", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("useTrue#dfdd4180", "#dfdd4180", &TLItem{tag: 0xdfdd4180, annotations: 0x0, tlName: "useTrue", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("usefulService.getUserEntity#3c857e52", "#3c857e52", &TLItem{tag: 0x3c857e52, annotations: 0x2, tlName: "usefulService.getUserEntity", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) } diff --git a/internal/tlcodegen/test/gen/goldmaster/tl/tl.go b/internal/tlcodegen/test/gen/goldmaster/tl/tl.go index ec8c5a33..f5550a5d 100644 --- a/internal/tlcodegen/test/gen/goldmaster/tl/tl.go +++ b/internal/tlcodegen/test/gen/goldmaster/tl/tl.go @@ -48,6 +48,7 @@ import ( "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlInt64" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlIntBoxedMaybe" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlIntMaybe" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlListService5Output" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlLong" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlMaybeTest1" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlMaybeWrapperInt3" @@ -170,6 +171,7 @@ type ( Int64 = tlInt64.Int64 IntBoxedMaybe = tlIntBoxedMaybe.IntBoxedMaybe IntMaybe = tlIntMaybe.IntMaybe + ListService5Output = tlListService5Output.ListService5Output Long = tlLong.Long MaybeTest1 = tlMaybeTest1.MaybeTest1 MaybeWrapperInt3 = tlMaybeWrapperInt3.MaybeWrapperInt3 diff --git a/internal/tlcodegen/test/gen/goldmaster/tlab/tlab.go b/internal/tlcodegen/test/gen/goldmaster/tlab/tlab.go index 4b80f46a..5baea982 100644 --- a/internal/tlcodegen/test/gen/goldmaster/tlab/tlab.go +++ b/internal/tlcodegen/test/gen/goldmaster/tlab/tlab.go @@ -13,6 +13,8 @@ import ( "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlAbMyTypeBoxedMaybe" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tl/tlAbMyTypeMaybe" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall1" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall10" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall11" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall2" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall3" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlab/tlAbCall4" @@ -36,6 +38,8 @@ import ( type ( Alias = cycle_b62dd5050d0a18c7485fd980c087f32c.AbAlias Call1 = tlAbCall1.AbCall1 + Call10 = tlAbCall10.AbCall10 + Call11 = tlAbCall11.AbCall11 Call2 = tlAbCall2.AbCall2 Call3 = tlAbCall3.AbCall3 Call4 = tlAbCall4.AbCall4 diff --git a/internal/tlcodegen/test/gen/goldmaster/tljson.html b/internal/tlcodegen/test/gen/goldmaster/tljson.html index 4947b156..d0ffeacc 100644 --- a/internal/tlcodegen/test/gen/goldmaster/tljson.html +++ b/internal/tlcodegen/test/gen/goldmaster/tljson.html @@ -21,6 +21,16 @@

Functions

ab.call1ab.TypeB +
  • + + ab.call10 + → a.Color +
  • +
  • + + ab.call11 + → a.Color +
  • ab.call2 @@ -111,6 +121,11 @@

    Functions

    service5.insertservice5.Output
  • +
  • + + service5.insertList + → List<service5.Output> +
  • service5Long.insert @@ -411,6 +426,46 @@

    ab.call1

    +

    ab.call10

    + +

    + Returns a.Color +
    +
    JSON
    +
    + {} +
    +
    TL
    +
    + read ab.call10#8db2a4f8 = a.Color; +
    +
    + +

    ab.call11

    + +

    + Returns a.Color +
    +
    JSON
    +
    + { + + + + + + + +
      "x": a.Color +
    + } +
    +
    TL
    +
    + read ab.call11#ecb2a36c x:a.Color = a.Color; +
    +
    +

    ab.call2

    @@ -2399,6 +2454,47 @@

    Maybe<int>

    +

    list<service5.Output>

    + //---- test recursive struct without union as result
    + +

    +
    +
    JSON
    +
    + { + + + + + + + + + + + + + + + + + + + +
      "flag": <uint32>, +
      "head": service5.Output,// flag bit #0 + +
      "tail": list<service5.Output>// flag bit #0 + +
    + } +
    +
    TL
    +
    + list#02d80cdd {X:Type} flag:# head:flag.0?X tail:flag.0?(list X) = List X; +
    +
    +

    maybeTest1

    @@ -4092,6 +4188,39 @@

    service5.insert

    +

    service5.insertList

    + +

    + Returns List<service5.Output> +
    +
    JSON
    +
    + { + + + + + + + + + + + + + +
      "flags": <uint32>, +
      "persistent": true// flags bit #0 + +
    + } +
    +
    TL
    +
    + readwrite service5.insertList#7cf362bc flags:# persistent:flags.0?%True = (List service5.Output); +
    +
    +

    service5Long.insert

    diff --git a/internal/tlcodegen/test/gen/goldmaster/tlservice5/tlservice5.go b/internal/tlcodegen/test/gen/goldmaster/tlservice5/tlservice5.go index 75b7f2e4..63e266f2 100644 --- a/internal/tlcodegen/test/gen/goldmaster/tlservice5/tlservice5.go +++ b/internal/tlcodegen/test/gen/goldmaster/tlservice5/tlservice5.go @@ -10,11 +10,13 @@ package tlservice5 import ( "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/cycle_16847572a0831d4cd4c0c0fb513151f3" "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlservice5/tlService5Insert" + "github.com/vkcom/tl/internal/tlcodegen/test/gen/goldmaster/internal/tlservice5/tlService5InsertList" ) type ( EmptyOutput = cycle_16847572a0831d4cd4c0c0fb513151f3.Service5EmptyOutput Insert = tlService5Insert.Service5Insert + InsertList = tlService5InsertList.Service5InsertList Output = cycle_16847572a0831d4cd4c0c0fb513151f3.Service5Output StringOutput = cycle_16847572a0831d4cd4c0c0fb513151f3.Service5StringOutput ) diff --git a/internal/tlcodegen/test/gen/goldmaster_nosplit/constants/constants.go b/internal/tlcodegen/test/gen/goldmaster_nosplit/constants/constants.go index c75b695a..c60bb096 100644 --- a/internal/tlcodegen/test/gen/goldmaster_nosplit/constants/constants.go +++ b/internal/tlcodegen/test/gen/goldmaster_nosplit/constants/constants.go @@ -21,6 +21,8 @@ const ( Aaa = 0x05b0e500 // aaa AbAlias = 0x944aaa97 // ab.alias AbCall1 = 0x20c5fb2d // ab.call1 + AbCall10 = 0x8db2a4f8 // ab.call10 + AbCall11 = 0xecb2a36c // ab.call11 AbCall2 = 0x77d5f057 // ab.call2 AbCall3 = 0x0a083445 // ab.call3 AbCall4 = 0xc1220a1e // ab.call4 @@ -82,6 +84,7 @@ const ( Int = 0xa8509bda // int Int32 = 0x7934e71f // int32 Int64 = 0xf5609de0 // int64 + List = 0x02d80cdd // list Long = 0x22076cba // long MaybeTest1 = 0xc457763c // maybeTest1 MaybeWrapper = 0x723390c4 // maybeWrapper @@ -118,6 +121,7 @@ const ( ResultTrue = 0x3f9c8ef8 // resultTrue Service5EmptyOutput = 0xff8f7db8 // service5.emptyOutput Service5Insert = 0x7cf362ba // service5.insert + Service5InsertList = 0x7cf362bc // service5.insertList Service5StringOutput = 0xdc170ff4 // service5.stringOutput Service5LongEmptyOutput = 0xff8f7db9 // service5Long.emptyOutput Service5LongInsert = 0x7cf362bb // service5Long.insert diff --git a/internal/tlcodegen/test/gen/goldmaster_nosplit/factory/factory.go b/internal/tlcodegen/test/gen/goldmaster_nosplit/factory/factory.go index 622a2dca..66b8fc86 100644 --- a/internal/tlcodegen/test/gen/goldmaster_nosplit/factory/factory.go +++ b/internal/tlcodegen/test/gen/goldmaster_nosplit/factory/factory.go @@ -39,6 +39,8 @@ func init() { meta.SetGlobalFactoryCreateForObject(0xa7662843, func() meta.Object { var ret internal.AUNionA; return &ret }) meta.SetGlobalFactoryCreateForObject(0x944aaa97, func() meta.Object { var ret internal.AbAlias; return &ret }) meta.SetGlobalFactoryCreateForFunction(0x20c5fb2d, func() meta.Object { var ret internal.AbCall1; return &ret }, func() meta.Function { var ret internal.AbCall1; return &ret }, nil) + meta.SetGlobalFactoryCreateForFunction(0x8db2a4f8, func() meta.Object { var ret internal.AbCall10; return &ret }, func() meta.Function { var ret internal.AbCall10; return &ret }, nil) + meta.SetGlobalFactoryCreateForFunction(0xecb2a36c, func() meta.Object { var ret internal.AbCall11; return &ret }, func() meta.Function { var ret internal.AbCall11; return &ret }, nil) meta.SetGlobalFactoryCreateForFunction(0x77d5f057, func() meta.Object { var ret internal.AbCall2; return &ret }, func() meta.Function { var ret internal.AbCall2; return &ret }, nil) meta.SetGlobalFactoryCreateForFunction(0x0a083445, func() meta.Object { var ret internal.AbCall3; return &ret }, func() meta.Function { var ret internal.AbCall3; return &ret }, nil) meta.SetGlobalFactoryCreateForFunction(0xc1220a1e, func() meta.Object { var ret internal.AbCall4; return &ret }, func() meta.Function { var ret internal.AbCall4; return &ret }, nil) @@ -116,6 +118,7 @@ func init() { meta.SetGlobalFactoryCreateForObject(0x95d598c5, func() meta.Object { var ret internal.Replace9; return &ret }) meta.SetGlobalFactoryCreateForObject(0xff8f7db8, func() meta.Object { var ret internal.Service5EmptyOutput; return &ret }) meta.SetGlobalFactoryCreateForFunction(0x7cf362ba, func() meta.Object { var ret internal.Service5Insert; return &ret }, func() meta.Function { var ret internal.Service5Insert; return &ret }, func() meta.Function { var ret internal.Service5LongInsert; return &ret }) + meta.SetGlobalFactoryCreateForFunction(0x7cf362bc, func() meta.Object { var ret internal.Service5InsertList; return &ret }, func() meta.Function { var ret internal.Service5InsertList; return &ret }, nil) meta.SetGlobalFactoryCreateForObject(0xff8f7db9, func() meta.Object { var ret internal.Service5LongEmptyOutput; return &ret }) meta.SetGlobalFactoryCreateForFunction(0x7cf362bb, func() meta.Object { var ret internal.Service5LongInsert; return &ret }, func() meta.Function { var ret internal.Service5LongInsert; return &ret }, nil) meta.SetGlobalFactoryCreateForObject(0xdc170ff5, func() meta.Object { var ret internal.Service5LongStringOutput; return &ret }) diff --git a/internal/tlcodegen/test/gen/goldmaster_nosplit/factory_bytes/factory_bytes.go b/internal/tlcodegen/test/gen/goldmaster_nosplit/factory_bytes/factory_bytes.go index d90875ac..7e5c4f1b 100644 --- a/internal/tlcodegen/test/gen/goldmaster_nosplit/factory_bytes/factory_bytes.go +++ b/internal/tlcodegen/test/gen/goldmaster_nosplit/factory_bytes/factory_bytes.go @@ -39,6 +39,8 @@ func init() { meta.SetGlobalFactoryCreateForObjectBytes(0xa7662843, func() meta.Object { var ret internal.AUNionA; return &ret }) meta.SetGlobalFactoryCreateForObjectBytes(0x944aaa97, func() meta.Object { var ret internal.AbAlias; return &ret }) meta.SetGlobalFactoryCreateForFunctionBytes(0x20c5fb2d, func() meta.Object { var ret internal.AbCall1; return &ret }, func() meta.Function { var ret internal.AbCall1; return &ret }, nil) + meta.SetGlobalFactoryCreateForFunctionBytes(0x8db2a4f8, func() meta.Object { var ret internal.AbCall10; return &ret }, func() meta.Function { var ret internal.AbCall10; return &ret }, nil) + meta.SetGlobalFactoryCreateForFunctionBytes(0xecb2a36c, func() meta.Object { var ret internal.AbCall11; return &ret }, func() meta.Function { var ret internal.AbCall11; return &ret }, nil) meta.SetGlobalFactoryCreateForFunctionBytes(0x77d5f057, func() meta.Object { var ret internal.AbCall2; return &ret }, func() meta.Function { var ret internal.AbCall2; return &ret }, nil) meta.SetGlobalFactoryCreateForFunctionBytes(0x0a083445, func() meta.Object { var ret internal.AbCall3; return &ret }, func() meta.Function { var ret internal.AbCall3; return &ret }, nil) meta.SetGlobalFactoryCreateForFunctionBytes(0xc1220a1e, func() meta.Object { var ret internal.AbCall4; return &ret }, func() meta.Function { var ret internal.AbCall4; return &ret }, nil) @@ -116,6 +118,7 @@ func init() { meta.SetGlobalFactoryCreateForObjectBytes(0x95d598c5, func() meta.Object { var ret internal.Replace9; return &ret }) meta.SetGlobalFactoryCreateForObjectBytes(0xff8f7db8, func() meta.Object { var ret internal.Service5EmptyOutput; return &ret }) meta.SetGlobalFactoryCreateForFunctionBytes(0x7cf362ba, func() meta.Object { var ret internal.Service5Insert; return &ret }, func() meta.Function { var ret internal.Service5Insert; return &ret }, func() meta.Function { var ret internal.Service5LongInsert; return &ret }) + meta.SetGlobalFactoryCreateForFunctionBytes(0x7cf362bc, func() meta.Object { var ret internal.Service5InsertList; return &ret }, func() meta.Function { var ret internal.Service5InsertList; return &ret }, nil) meta.SetGlobalFactoryCreateForObjectBytes(0xff8f7db9, func() meta.Object { var ret internal.Service5LongEmptyOutput; return &ret }) meta.SetGlobalFactoryCreateForFunctionBytes(0x7cf362bb, func() meta.Object { var ret internal.Service5LongInsert; return &ret }, func() meta.Function { var ret internal.Service5LongInsert; return &ret }, nil) meta.SetGlobalFactoryCreateForObjectBytes(0xdc170ff5, func() meta.Object { var ret internal.Service5LongStringOutput; return &ret }) diff --git a/internal/tlcodegen/test/gen/goldmaster_nosplit/internal/ab.call10.go b/internal/tlcodegen/test/gen/goldmaster_nosplit/internal/ab.call10.go new file mode 100644 index 00000000..0a63f6ed --- /dev/null +++ b/internal/tlcodegen/test/gen/goldmaster_nosplit/internal/ab.call10.go @@ -0,0 +1,150 @@ +// Copyright 2022 V Kontakte LLC +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +// Code generated by vktl/cmd/tlgen2; DO NOT EDIT. +package internal + +import ( + "github.com/vkcom/tl/pkg/basictl" +) + +var _ = basictl.NatWrite + +type AbCall10 struct { +} + +func (AbCall10) TLName() string { return "ab.call10" } +func (AbCall10) TLTag() uint32 { return 0x8db2a4f8 } + +func (item *AbCall10) Reset() {} + +func (item *AbCall10) FillRandom(rg *basictl.RandGenerator) {} + +func (item *AbCall10) Read(w []byte) (_ []byte, err error) { return w, nil } + +// This method is general version of Write, use it instead! +func (item *AbCall10) WriteGeneral(w []byte) (_ []byte, err error) { + return item.Write(w), nil +} + +func (item *AbCall10) Write(w []byte) []byte { + return w +} + +func (item *AbCall10) ReadBoxed(w []byte) (_ []byte, err error) { + if w, err = basictl.NatReadExactTag(w, 0x8db2a4f8); err != nil { + return w, err + } + return item.Read(w) +} + +// This method is general version of WriteBoxed, use it instead! +func (item *AbCall10) WriteBoxedGeneral(w []byte) (_ []byte, err error) { + return item.WriteBoxed(w), nil +} + +func (item *AbCall10) WriteBoxed(w []byte) []byte { + w = basictl.NatWrite(w, 0x8db2a4f8) + return item.Write(w) +} + +func (item *AbCall10) ReadResult(w []byte, ret *AColor) (_ []byte, err error) { + return ret.ReadBoxed(w) +} + +func (item *AbCall10) WriteResult(w []byte, ret AColor) (_ []byte, err error) { + w = ret.WriteBoxed(w) + return w, nil +} + +func (item *AbCall10) ReadResultJSON(legacyTypeNames bool, in *basictl.JsonLexer, ret *AColor) error { + if err := ret.ReadJSON(legacyTypeNames, in); err != nil { + return err + } + return nil +} + +func (item *AbCall10) WriteResultJSON(w []byte, ret AColor) (_ []byte, err error) { + return item.writeResultJSON(true, false, w, ret) +} + +func (item *AbCall10) writeResultJSON(newTypeNames bool, short bool, w []byte, ret AColor) (_ []byte, err error) { + w = ret.WriteJSONOpt(newTypeNames, short, w) + return w, nil +} + +func (item *AbCall10) ReadResultWriteResultJSON(r []byte, w []byte) (_ []byte, _ []byte, err error) { + var ret AColor + if r, err = item.ReadResult(r, &ret); err != nil { + return r, w, err + } + w, err = item.WriteResultJSON(w, ret) + return r, w, err +} + +func (item *AbCall10) ReadResultWriteResultJSONOpt(newTypeNames bool, short bool, r []byte, w []byte) (_ []byte, _ []byte, err error) { + var ret AColor + if r, err = item.ReadResult(r, &ret); err != nil { + return r, w, err + } + w, err = item.writeResultJSON(newTypeNames, short, w, ret) + return r, w, err +} + +func (item *AbCall10) ReadResultJSONWriteResult(r []byte, w []byte) ([]byte, []byte, error) { + var ret AColor + err := item.ReadResultJSON(true, &basictl.JsonLexer{Data: r}, &ret) + if err != nil { + return r, w, err + } + w, err = item.WriteResult(w, ret) + return r, w, err +} + +func (item AbCall10) String() string { + return string(item.WriteJSON(nil)) +} + +func (item *AbCall10) ReadJSON(legacyTypeNames bool, in *basictl.JsonLexer) error { + if in != nil { + in.Delim('{') + if !in.Ok() { + return in.Error() + } + for !in.IsDelim('}') { + return ErrorInvalidJSON("ab.call10", "this object can't have properties") + } + in.Delim('}') + if !in.Ok() { + return in.Error() + } + } + return nil +} + +// This method is general version of WriteJSON, use it instead! +func (item *AbCall10) WriteJSONGeneral(w []byte) (_ []byte, err error) { + return item.WriteJSONOpt(true, false, w), nil +} + +func (item *AbCall10) WriteJSON(w []byte) []byte { + return item.WriteJSONOpt(true, false, w) +} +func (item *AbCall10) WriteJSONOpt(newTypeNames bool, short bool, w []byte) []byte { + w = append(w, '{') + return append(w, '}') +} + +func (item *AbCall10) MarshalJSON() ([]byte, error) { + return item.WriteJSON(nil), nil +} + +func (item *AbCall10) UnmarshalJSON(b []byte) error { + if err := item.ReadJSON(true, &basictl.JsonLexer{Data: b}); err != nil { + return ErrorInvalidJSON("ab.call10", err.Error()) + } + return nil +} diff --git a/internal/tlcodegen/test/gen/goldmaster_nosplit/internal/ab.call11.go b/internal/tlcodegen/test/gen/goldmaster_nosplit/internal/ab.call11.go new file mode 100644 index 00000000..2f83dcba --- /dev/null +++ b/internal/tlcodegen/test/gen/goldmaster_nosplit/internal/ab.call11.go @@ -0,0 +1,180 @@ +// Copyright 2022 V Kontakte LLC +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +// Code generated by vktl/cmd/tlgen2; DO NOT EDIT. +package internal + +import ( + "github.com/vkcom/tl/pkg/basictl" +) + +var _ = basictl.NatWrite + +type AbCall11 struct { + X AColor +} + +func (AbCall11) TLName() string { return "ab.call11" } +func (AbCall11) TLTag() uint32 { return 0xecb2a36c } + +func (item *AbCall11) Reset() { + item.X.Reset() +} + +func (item *AbCall11) FillRandom(rg *basictl.RandGenerator) { + item.X.FillRandom(rg) +} + +func (item *AbCall11) Read(w []byte) (_ []byte, err error) { + return item.X.ReadBoxed(w) +} + +// This method is general version of Write, use it instead! +func (item *AbCall11) WriteGeneral(w []byte) (_ []byte, err error) { + return item.Write(w), nil +} + +func (item *AbCall11) Write(w []byte) []byte { + w = item.X.WriteBoxed(w) + return w +} + +func (item *AbCall11) ReadBoxed(w []byte) (_ []byte, err error) { + if w, err = basictl.NatReadExactTag(w, 0xecb2a36c); err != nil { + return w, err + } + return item.Read(w) +} + +// This method is general version of WriteBoxed, use it instead! +func (item *AbCall11) WriteBoxedGeneral(w []byte) (_ []byte, err error) { + return item.WriteBoxed(w), nil +} + +func (item *AbCall11) WriteBoxed(w []byte) []byte { + w = basictl.NatWrite(w, 0xecb2a36c) + return item.Write(w) +} + +func (item *AbCall11) ReadResult(w []byte, ret *AColor) (_ []byte, err error) { + return ret.ReadBoxed(w) +} + +func (item *AbCall11) WriteResult(w []byte, ret AColor) (_ []byte, err error) { + w = ret.WriteBoxed(w) + return w, nil +} + +func (item *AbCall11) ReadResultJSON(legacyTypeNames bool, in *basictl.JsonLexer, ret *AColor) error { + if err := ret.ReadJSON(legacyTypeNames, in); err != nil { + return err + } + return nil +} + +func (item *AbCall11) WriteResultJSON(w []byte, ret AColor) (_ []byte, err error) { + return item.writeResultJSON(true, false, w, ret) +} + +func (item *AbCall11) writeResultJSON(newTypeNames bool, short bool, w []byte, ret AColor) (_ []byte, err error) { + w = ret.WriteJSONOpt(newTypeNames, short, w) + return w, nil +} + +func (item *AbCall11) ReadResultWriteResultJSON(r []byte, w []byte) (_ []byte, _ []byte, err error) { + var ret AColor + if r, err = item.ReadResult(r, &ret); err != nil { + return r, w, err + } + w, err = item.WriteResultJSON(w, ret) + return r, w, err +} + +func (item *AbCall11) ReadResultWriteResultJSONOpt(newTypeNames bool, short bool, r []byte, w []byte) (_ []byte, _ []byte, err error) { + var ret AColor + if r, err = item.ReadResult(r, &ret); err != nil { + return r, w, err + } + w, err = item.writeResultJSON(newTypeNames, short, w, ret) + return r, w, err +} + +func (item *AbCall11) ReadResultJSONWriteResult(r []byte, w []byte) ([]byte, []byte, error) { + var ret AColor + err := item.ReadResultJSON(true, &basictl.JsonLexer{Data: r}, &ret) + if err != nil { + return r, w, err + } + w, err = item.WriteResult(w, ret) + return r, w, err +} + +func (item AbCall11) String() string { + return string(item.WriteJSON(nil)) +} + +func (item *AbCall11) ReadJSON(legacyTypeNames bool, in *basictl.JsonLexer) error { + var propXPresented bool + + if in != nil { + in.Delim('{') + if !in.Ok() { + return in.Error() + } + for !in.IsDelim('}') { + key := in.UnsafeFieldName(true) + in.WantColon() + switch key { + case "x": + if propXPresented { + return ErrorInvalidJSONWithDuplicatingKeys("ab.call11", "x") + } + if err := item.X.ReadJSON(legacyTypeNames, in); err != nil { + return err + } + propXPresented = true + default: + return ErrorInvalidJSONExcessElement("ab.call11", key) + } + in.WantComma() + } + in.Delim('}') + if !in.Ok() { + return in.Error() + } + } + if !propXPresented { + item.X.Reset() + } + return nil +} + +// This method is general version of WriteJSON, use it instead! +func (item *AbCall11) WriteJSONGeneral(w []byte) (_ []byte, err error) { + return item.WriteJSONOpt(true, false, w), nil +} + +func (item *AbCall11) WriteJSON(w []byte) []byte { + return item.WriteJSONOpt(true, false, w) +} +func (item *AbCall11) WriteJSONOpt(newTypeNames bool, short bool, w []byte) []byte { + w = append(w, '{') + w = basictl.JSONAddCommaIfNeeded(w) + w = append(w, `"x":`...) + w = item.X.WriteJSONOpt(newTypeNames, short, w) + return append(w, '}') +} + +func (item *AbCall11) MarshalJSON() ([]byte, error) { + return item.WriteJSON(nil), nil +} + +func (item *AbCall11) UnmarshalJSON(b []byte) error { + if err := item.ReadJSON(true, &basictl.JsonLexer{Data: b}); err != nil { + return ErrorInvalidJSON("ab.call11", err.Error()) + } + return nil +} diff --git a/internal/tlcodegen/test/gen/goldmaster_nosplit/internal/list.go b/internal/tlcodegen/test/gen/goldmaster_nosplit/internal/list.go new file mode 100644 index 00000000..470f36e5 --- /dev/null +++ b/internal/tlcodegen/test/gen/goldmaster_nosplit/internal/list.go @@ -0,0 +1,261 @@ +// Copyright 2022 V Kontakte LLC +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +// Code generated by vktl/cmd/tlgen2; DO NOT EDIT. +package internal + +import ( + "github.com/vkcom/tl/pkg/basictl" +) + +var _ = basictl.NatWrite + +type ListService5Output struct { + Flag uint32 + Head Service5Output // Conditional: item.Flag.0 + Tail *ListService5Output // Conditional: item.Flag.0 +} + +func (ListService5Output) TLName() string { return "list" } +func (ListService5Output) TLTag() uint32 { return 0x02d80cdd } + +func (item *ListService5Output) SetHead(v Service5Output) { + item.Head = v + item.Flag |= 1 << 0 +} +func (item *ListService5Output) ClearHead() { + item.Head.Reset() + item.Flag &^= 1 << 0 +} +func (item ListService5Output) IsSetHead() bool { return item.Flag&(1<<0) != 0 } + +func (item *ListService5Output) SetTail(v ListService5Output) { + if item.Tail == nil { + var value ListService5Output + item.Tail = &value + } + *item.Tail = v + item.Flag |= 1 << 0 +} +func (item *ListService5Output) ClearTail() { + if item.Tail != nil { + item.Tail.Reset() + } + item.Flag &^= 1 << 0 +} +func (item ListService5Output) IsSetTail() bool { return item.Flag&(1<<0) != 0 } + +func (item *ListService5Output) Reset() { + item.Flag = 0 + item.Head.Reset() + if item.Tail != nil { + item.Tail.Reset() + } +} + +func (item *ListService5Output) FillRandom(rg *basictl.RandGenerator) { + var maskFlag uint32 + maskFlag = basictl.RandomUint(rg) + item.Flag = 0 + if maskFlag&(1<<0) != 0 { + item.Flag |= (1 << 0) + } + if item.Flag&(1<<0) != 0 { + item.Head.FillRandom(rg) + } else { + item.Head.Reset() + } + if item.Flag&(1<<0) != 0 { + rg.IncreaseDepth() + if item.Tail == nil { + var value ListService5Output + item.Tail = &value + } + item.Tail.FillRandom(rg) + rg.DecreaseDepth() + } else { + if item.Tail != nil { + item.Tail.Reset() + } + } +} + +func (item *ListService5Output) Read(w []byte) (_ []byte, err error) { + if w, err = basictl.NatRead(w, &item.Flag); err != nil { + return w, err + } + if item.Flag&(1<<0) != 0 { + if w, err = item.Head.ReadBoxed(w); err != nil { + return w, err + } + } else { + item.Head.Reset() + } + if item.Flag&(1<<0) != 0 { + if item.Tail == nil { + var value ListService5Output + item.Tail = &value + } + if w, err = item.Tail.Read(w); err != nil { + return w, err + } + } else { + if item.Tail != nil { + item.Tail.Reset() + } + } + return w, nil +} + +// This method is general version of Write, use it instead! +func (item *ListService5Output) WriteGeneral(w []byte) (_ []byte, err error) { + return item.Write(w), nil +} + +func (item *ListService5Output) Write(w []byte) []byte { + w = basictl.NatWrite(w, item.Flag) + if item.Flag&(1<<0) != 0 { + w = item.Head.WriteBoxed(w) + } + if item.Flag&(1<<0) != 0 { + w = item.Tail.Write(w) + } + return w +} + +func (item *ListService5Output) ReadBoxed(w []byte) (_ []byte, err error) { + if w, err = basictl.NatReadExactTag(w, 0x02d80cdd); err != nil { + return w, err + } + return item.Read(w) +} + +// This method is general version of WriteBoxed, use it instead! +func (item *ListService5Output) WriteBoxedGeneral(w []byte) (_ []byte, err error) { + return item.WriteBoxed(w), nil +} + +func (item *ListService5Output) WriteBoxed(w []byte) []byte { + w = basictl.NatWrite(w, 0x02d80cdd) + return item.Write(w) +} + +func (item ListService5Output) String() string { + return string(item.WriteJSON(nil)) +} + +func (item *ListService5Output) ReadJSON(legacyTypeNames bool, in *basictl.JsonLexer) error { + var propFlagPresented bool + var propHeadPresented bool + var propTailPresented bool + + if in != nil { + in.Delim('{') + if !in.Ok() { + return in.Error() + } + for !in.IsDelim('}') { + key := in.UnsafeFieldName(true) + in.WantColon() + switch key { + case "flag": + if propFlagPresented { + return ErrorInvalidJSONWithDuplicatingKeys("list", "flag") + } + if err := Json2ReadUint32(in, &item.Flag); err != nil { + return err + } + propFlagPresented = true + case "head": + if propHeadPresented { + return ErrorInvalidJSONWithDuplicatingKeys("list", "head") + } + if err := item.Head.ReadJSON(legacyTypeNames, in); err != nil { + return err + } + propHeadPresented = true + case "tail": + if propTailPresented { + return ErrorInvalidJSONWithDuplicatingKeys("list", "tail") + } + if item.Tail == nil { + var value ListService5Output + item.Tail = &value + } + if err := item.Tail.ReadJSON(legacyTypeNames, in); err != nil { + return err + } + propTailPresented = true + default: + return ErrorInvalidJSONExcessElement("list", key) + } + in.WantComma() + } + in.Delim('}') + if !in.Ok() { + return in.Error() + } + } + if !propFlagPresented { + item.Flag = 0 + } + if !propHeadPresented { + item.Head.Reset() + } + if !propTailPresented { + if item.Tail != nil { + item.Tail.Reset() + } + } + if propHeadPresented { + item.Flag |= 1 << 0 + } + if propTailPresented { + item.Flag |= 1 << 0 + } + return nil +} + +// This method is general version of WriteJSON, use it instead! +func (item *ListService5Output) WriteJSONGeneral(w []byte) (_ []byte, err error) { + return item.WriteJSONOpt(true, false, w), nil +} + +func (item *ListService5Output) WriteJSON(w []byte) []byte { + return item.WriteJSONOpt(true, false, w) +} +func (item *ListService5Output) WriteJSONOpt(newTypeNames bool, short bool, w []byte) []byte { + w = append(w, '{') + backupIndexFlag := len(w) + w = basictl.JSONAddCommaIfNeeded(w) + w = append(w, `"flag":`...) + w = basictl.JSONWriteUint32(w, item.Flag) + if (item.Flag != 0) == false { + w = w[:backupIndexFlag] + } + if item.Flag&(1<<0) != 0 { + w = basictl.JSONAddCommaIfNeeded(w) + w = append(w, `"head":`...) + w = item.Head.WriteJSONOpt(newTypeNames, short, w) + } + if item.Flag&(1<<0) != 0 { + w = basictl.JSONAddCommaIfNeeded(w) + w = append(w, `"tail":`...) + w = item.Tail.WriteJSONOpt(newTypeNames, short, w) + } + return append(w, '}') +} + +func (item *ListService5Output) MarshalJSON() ([]byte, error) { + return item.WriteJSON(nil), nil +} + +func (item *ListService5Output) UnmarshalJSON(b []byte) error { + if err := item.ReadJSON(true, &basictl.JsonLexer{Data: b}); err != nil { + return ErrorInvalidJSON("list", err.Error()) + } + return nil +} diff --git a/internal/tlcodegen/test/gen/goldmaster_nosplit/internal/service5.insertList.go b/internal/tlcodegen/test/gen/goldmaster_nosplit/internal/service5.insertList.go new file mode 100644 index 00000000..90a150ce --- /dev/null +++ b/internal/tlcodegen/test/gen/goldmaster_nosplit/internal/service5.insertList.go @@ -0,0 +1,225 @@ +// Copyright 2022 V Kontakte LLC +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +// Code generated by vktl/cmd/tlgen2; DO NOT EDIT. +package internal + +import ( + "github.com/vkcom/tl/pkg/basictl" +) + +var _ = basictl.NatWrite + +type Service5InsertList struct { + Flags uint32 + // Persistent (TrueType) // Conditional: item.Flags.0 +} + +func (Service5InsertList) TLName() string { return "service5.insertList" } +func (Service5InsertList) TLTag() uint32 { return 0x7cf362bc } + +func (item *Service5InsertList) SetPersistent(v bool) { + if v { + item.Flags |= 1 << 0 + } else { + item.Flags &^= 1 << 0 + } +} +func (item Service5InsertList) IsSetPersistent() bool { return item.Flags&(1<<0) != 0 } + +func (item *Service5InsertList) Reset() { + item.Flags = 0 +} + +func (item *Service5InsertList) FillRandom(rg *basictl.RandGenerator) { + var maskFlags uint32 + maskFlags = basictl.RandomUint(rg) + item.Flags = 0 + if maskFlags&(1<<0) != 0 { + item.Flags |= (1 << 0) + } +} + +func (item *Service5InsertList) Read(w []byte) (_ []byte, err error) { + if w, err = basictl.NatRead(w, &item.Flags); err != nil { + return w, err + } + return w, nil +} + +// This method is general version of Write, use it instead! +func (item *Service5InsertList) WriteGeneral(w []byte) (_ []byte, err error) { + return item.Write(w), nil +} + +func (item *Service5InsertList) Write(w []byte) []byte { + w = basictl.NatWrite(w, item.Flags) + return w +} + +func (item *Service5InsertList) ReadBoxed(w []byte) (_ []byte, err error) { + if w, err = basictl.NatReadExactTag(w, 0x7cf362bc); err != nil { + return w, err + } + return item.Read(w) +} + +// This method is general version of WriteBoxed, use it instead! +func (item *Service5InsertList) WriteBoxedGeneral(w []byte) (_ []byte, err error) { + return item.WriteBoxed(w), nil +} + +func (item *Service5InsertList) WriteBoxed(w []byte) []byte { + w = basictl.NatWrite(w, 0x7cf362bc) + return item.Write(w) +} + +func (item *Service5InsertList) ReadResult(w []byte, ret *ListService5Output) (_ []byte, err error) { + return ret.ReadBoxed(w) +} + +func (item *Service5InsertList) WriteResult(w []byte, ret ListService5Output) (_ []byte, err error) { + w = ret.WriteBoxed(w) + return w, nil +} + +func (item *Service5InsertList) ReadResultJSON(legacyTypeNames bool, in *basictl.JsonLexer, ret *ListService5Output) error { + if err := ret.ReadJSON(legacyTypeNames, in); err != nil { + return err + } + return nil +} + +func (item *Service5InsertList) WriteResultJSON(w []byte, ret ListService5Output) (_ []byte, err error) { + return item.writeResultJSON(true, false, w, ret) +} + +func (item *Service5InsertList) writeResultJSON(newTypeNames bool, short bool, w []byte, ret ListService5Output) (_ []byte, err error) { + w = ret.WriteJSONOpt(newTypeNames, short, w) + return w, nil +} + +func (item *Service5InsertList) ReadResultWriteResultJSON(r []byte, w []byte) (_ []byte, _ []byte, err error) { + var ret ListService5Output + if r, err = item.ReadResult(r, &ret); err != nil { + return r, w, err + } + w, err = item.WriteResultJSON(w, ret) + return r, w, err +} + +func (item *Service5InsertList) ReadResultWriteResultJSONOpt(newTypeNames bool, short bool, r []byte, w []byte) (_ []byte, _ []byte, err error) { + var ret ListService5Output + if r, err = item.ReadResult(r, &ret); err != nil { + return r, w, err + } + w, err = item.writeResultJSON(newTypeNames, short, w, ret) + return r, w, err +} + +func (item *Service5InsertList) ReadResultJSONWriteResult(r []byte, w []byte) ([]byte, []byte, error) { + var ret ListService5Output + err := item.ReadResultJSON(true, &basictl.JsonLexer{Data: r}, &ret) + if err != nil { + return r, w, err + } + w, err = item.WriteResult(w, ret) + return r, w, err +} + +func (item Service5InsertList) String() string { + return string(item.WriteJSON(nil)) +} + +func (item *Service5InsertList) ReadJSON(legacyTypeNames bool, in *basictl.JsonLexer) error { + var propFlagsPresented bool + var trueTypePersistentPresented bool + var trueTypePersistentValue bool + + if in != nil { + in.Delim('{') + if !in.Ok() { + return in.Error() + } + for !in.IsDelim('}') { + key := in.UnsafeFieldName(true) + in.WantColon() + switch key { + case "flags": + if propFlagsPresented { + return ErrorInvalidJSONWithDuplicatingKeys("service5.insertList", "flags") + } + if err := Json2ReadUint32(in, &item.Flags); err != nil { + return err + } + propFlagsPresented = true + case "persistent": + if trueTypePersistentPresented { + return ErrorInvalidJSONWithDuplicatingKeys("service5.insertList", "persistent") + } + if err := Json2ReadBool(in, &trueTypePersistentValue); err != nil { + return err + } + trueTypePersistentPresented = true + default: + return ErrorInvalidJSONExcessElement("service5.insertList", key) + } + in.WantComma() + } + in.Delim('}') + if !in.Ok() { + return in.Error() + } + } + if !propFlagsPresented { + item.Flags = 0 + } + if trueTypePersistentPresented { + if trueTypePersistentValue { + item.Flags |= 1 << 0 + } + } + // tries to set bit to zero if it is 1 + if trueTypePersistentPresented && !trueTypePersistentValue && (item.Flags&(1<<0) != 0) { + return ErrorInvalidJSON("service5.insertList", "fieldmask bit flags.0 is indefinite because of the contradictions in values") + } + return nil +} + +// This method is general version of WriteJSON, use it instead! +func (item *Service5InsertList) WriteJSONGeneral(w []byte) (_ []byte, err error) { + return item.WriteJSONOpt(true, false, w), nil +} + +func (item *Service5InsertList) WriteJSON(w []byte) []byte { + return item.WriteJSONOpt(true, false, w) +} +func (item *Service5InsertList) WriteJSONOpt(newTypeNames bool, short bool, w []byte) []byte { + w = append(w, '{') + backupIndexFlags := len(w) + w = basictl.JSONAddCommaIfNeeded(w) + w = append(w, `"flags":`...) + w = basictl.JSONWriteUint32(w, item.Flags) + if (item.Flags != 0) == false { + w = w[:backupIndexFlags] + } + if item.Flags&(1<<0) != 0 { + w = basictl.JSONAddCommaIfNeeded(w) + w = append(w, `"persistent":true`...) + } + return append(w, '}') +} + +func (item *Service5InsertList) MarshalJSON() ([]byte, error) { + return item.WriteJSON(nil), nil +} + +func (item *Service5InsertList) UnmarshalJSON(b []byte) error { + if err := item.ReadJSON(true, &basictl.JsonLexer{Data: b}); err != nil { + return ErrorInvalidJSON("service5.insertList", err.Error()) + } + return nil +} diff --git a/internal/tlcodegen/test/gen/goldmaster_nosplit/meta/meta.go b/internal/tlcodegen/test/gen/goldmaster_nosplit/meta/meta.go index 0fede745..e36a79dd 100644 --- a/internal/tlcodegen/test/gen/goldmaster_nosplit/meta/meta.go +++ b/internal/tlcodegen/test/gen/goldmaster_nosplit/meta/meta.go @@ -129,9 +129,13 @@ func CreateObjectFromNameBytes(name string) Object { } type TLItem struct { - tag uint32 - annotations uint32 - tlName string + tag uint32 + annotations uint32 + tlName string + + resultTypeContainsUnionTypes bool + argumentsTypesContainUnionTypes bool + createFunction func() Function createFunctionLong func() Function createObject func() Object @@ -146,6 +150,9 @@ func (item TLItem) CreateObject() Object { return item.createObject() } func (item TLItem) IsFunction() bool { return item.createFunction != nil } func (item TLItem) CreateFunction() Function { return item.createFunction() } +func (item TLItem) HasUnionTypesInResult() bool { return item.resultTypeContainsUnionTypes } +func (item TLItem) HasUnionTypesInArguments() bool { return item.argumentsTypesContainUnionTypes } + // For transcoding short-long version during Long ID transition func (item TLItem) HasFunctionLong() bool { return item.createFunctionLong != nil } func (item TLItem) CreateFunctionLong() Function { return item.createFunctionLong() } @@ -298,107 +305,110 @@ func fillFunction(n1 string, n2 string, item *TLItem) { } func init() { - fillObject("a.blue#623360f3", "#623360f3", &TLItem{tag: 0x623360f3, annotations: 0x0, tlName: "a.blue"}) - fillObject("a.color#f35d7a69", "#f35d7a69", &TLItem{tag: 0xf35d7a69, annotations: 0x0, tlName: "a.color"}) - fillObject("a.green#6127e7b8", "#6127e7b8", &TLItem{tag: 0x6127e7b8, annotations: 0x0, tlName: "a.green"}) - fillObject("a.red#b83a723d", "#b83a723d", &TLItem{tag: 0xb83a723d, annotations: 0x0, tlName: "a.red"}) - fillObject("a.top2#7082d18f", "#7082d18f", &TLItem{tag: 0x7082d18f, annotations: 0x0, tlName: "a.top2"}) - fillObject("a.uNionA#a7662843", "#a7662843", &TLItem{tag: 0xa7662843, annotations: 0x0, tlName: "a.uNionA"}) - fillObject("ab.alias#944aaa97", "#944aaa97", &TLItem{tag: 0x944aaa97, annotations: 0x0, tlName: "ab.alias"}) - fillFunction("ab.call1#20c5fb2d", "#20c5fb2d", &TLItem{tag: 0x20c5fb2d, annotations: 0x1, tlName: "ab.call1"}) - fillFunction("ab.call2#77d5f057", "#77d5f057", &TLItem{tag: 0x77d5f057, annotations: 0x1, tlName: "ab.call2"}) - fillFunction("ab.call3#0a083445", "#0a083445", &TLItem{tag: 0x0a083445, annotations: 0x1, tlName: "ab.call3"}) - fillFunction("ab.call4#c1220a1e", "#c1220a1e", &TLItem{tag: 0xc1220a1e, annotations: 0x1, tlName: "ab.call4"}) - fillFunction("ab.call5#7ba4d28d", "#7ba4d28d", &TLItem{tag: 0x7ba4d28d, annotations: 0x1, tlName: "ab.call5"}) - fillFunction("ab.call6#84d815cb", "#84d815cb", &TLItem{tag: 0x84d815cb, annotations: 0x1, tlName: "ab.call6"}) - fillFunction("ab.call7#46ec10bf", "#46ec10bf", &TLItem{tag: 0x46ec10bf, annotations: 0x1, tlName: "ab.call7"}) - fillFunction("ab.call8#1b8652d9", "#1b8652d9", &TLItem{tag: 0x1b8652d9, annotations: 0x1, tlName: "ab.call8"}) - fillFunction("ab.call9#75de906c", "#75de906c", &TLItem{tag: 0x75de906c, annotations: 0x1, tlName: "ab.call9"}) - fillObject("ab.code#7651b1ac", "#7651b1ac", &TLItem{tag: 0x7651b1ac, annotations: 0x0, tlName: "ab.code"}) - fillObject("ab.counterChangeRequestPeriodsMany#14a35d80", "#14a35d80", &TLItem{tag: 0x14a35d80, annotations: 0x0, tlName: "ab.counterChangeRequestPeriodsMany"}) - fillObject("ab.counterChangeRequestPeriodsOne#d9c36de5", "#d9c36de5", &TLItem{tag: 0xd9c36de5, annotations: 0x0, tlName: "ab.counterChangeRequestPeriodsOne"}) - fillObject("ab.empty#1ec6a63e", "#1ec6a63e", &TLItem{tag: 0x1ec6a63e, annotations: 0x0, tlName: "ab.empty"}) - fillObject("ab.myType#e0e96c86", "#e0e96c86", &TLItem{tag: 0xe0e96c86, annotations: 0x0, tlName: "ab.myType"}) - fillObject("ab.testMaybe#4dac492a", "#4dac492a", &TLItem{tag: 0x4dac492a, annotations: 0x0, tlName: "ab.testMaybe"}) - fillObject("ab.topLevel1#e67bce28", "#e67bce28", &TLItem{tag: 0xe67bce28, annotations: 0x0, tlName: "ab.topLevel1"}) - fillObject("ab.topLevel2#cef933fb", "#cef933fb", &TLItem{tag: 0xcef933fb, annotations: 0x0, tlName: "ab.topLevel2"}) - fillObject("ab.typeA#a99fef6a", "#a99fef6a", &TLItem{tag: 0xa99fef6a, annotations: 0x0, tlName: "ab.typeA"}) - fillObject("ab.typeB#ff2e6d58", "#ff2e6d58", &TLItem{tag: 0xff2e6d58, annotations: 0x0, tlName: "ab.typeB"}) - fillObject("ab.typeC#69920d6e", "#69920d6e", &TLItem{tag: 0x69920d6e, annotations: 0x0, tlName: "ab.typeC"}) - fillObject("ab.typeD#76615bf1", "#76615bf1", &TLItem{tag: 0x76615bf1, annotations: 0x0, tlName: "ab.typeD"}) - fillObject("ab.useCycle#71687381", "#71687381", &TLItem{tag: 0x71687381, annotations: 0x0, tlName: "ab.useCycle"}) - fillObject("ab.useDictString#3325d884", "#3325d884", &TLItem{tag: 0x3325d884, annotations: 0x0, tlName: "ab.useDictString"}) - fillObject("au.nionA#df61f632", "#df61f632", &TLItem{tag: 0xdf61f632, annotations: 0x0, tlName: "au.nionA"}) - fillObject("b.red#a9471844", "#a9471844", &TLItem{tag: 0xa9471844, annotations: 0x0, tlName: "b.red"}) - fillFunction("call1#a7302fbc", "#a7302fbc", &TLItem{tag: 0xa7302fbc, annotations: 0x1, tlName: "call1"}) - fillFunction("call2#f02024c6", "#f02024c6", &TLItem{tag: 0xf02024c6, annotations: 0x1, tlName: "call2"}) - fillFunction("call3#6ace6718", "#6ace6718", &TLItem{tag: 0x6ace6718, annotations: 0x1, tlName: "call3"}) - fillFunction("call4#46d7de8f", "#46d7de8f", &TLItem{tag: 0x46d7de8f, annotations: 0x1, tlName: "call4"}) - fillFunction("call5#fc51061c", "#fc51061c", &TLItem{tag: 0xfc51061c, annotations: 0x1, tlName: "call5"}) - fillFunction("call6#e41e4696", "#e41e4696", &TLItem{tag: 0xe41e4696, annotations: 0x1, tlName: "call6"}) - fillFunction("call7#262a43e2", "#262a43e2", &TLItem{tag: 0x262a43e2, annotations: 0x1, tlName: "call7"}) - fillFunction("call8#7b400184", "#7b400184", &TLItem{tag: 0x7b400184, annotations: 0x1, tlName: "call8"}) - fillFunction("call9#67a0d62d", "#67a0d62d", &TLItem{tag: 0x67a0d62d, annotations: 0x1, tlName: "call9"}) - fillObject("cd.myType#eab6a6b4", "#eab6a6b4", &TLItem{tag: 0xeab6a6b4, annotations: 0x0, tlName: "cd.myType"}) - fillObject("cd.response#8c202f64", "#8c202f64", &TLItem{tag: 0x8c202f64, annotations: 0x0, tlName: "cd.response"}) - fillObject("cd.topLevel3#5cd1ca89", "#5cd1ca89", &TLItem{tag: 0x5cd1ca89, annotations: 0x0, tlName: "cd.topLevel3"}) - fillObject("cd.typeA#a831a920", "#a831a920", &TLItem{tag: 0xa831a920, annotations: 0x0, tlName: "cd.typeA"}) - fillObject("cd.typeB#377b4996", "#377b4996", &TLItem{tag: 0x377b4996, annotations: 0x0, tlName: "cd.typeB"}) - fillObject("cd.typeC#db0f93d4", "#db0f93d4", &TLItem{tag: 0xdb0f93d4, annotations: 0x0, tlName: "cd.typeC"}) - fillObject("cd.typeD#b5528285", "#b5528285", &TLItem{tag: 0xb5528285, annotations: 0x0, tlName: "cd.typeD"}) - fillObject("cd.useCycle#6ed67ca0", "#6ed67ca0", &TLItem{tag: 0x6ed67ca0, annotations: 0x0, tlName: "cd.useCycle"}) - fillObject("cyc1.myCycle#136ecc9e", "#136ecc9e", &TLItem{tag: 0x136ecc9e, annotations: 0x0, tlName: "cyc1.myCycle"}) - fillObject("cyc2.myCycle#fba5eecb", "#fba5eecb", &TLItem{tag: 0xfba5eecb, annotations: 0x0, tlName: "cyc2.myCycle"}) - fillObject("cyc3.myCycle#47866860", "#47866860", &TLItem{tag: 0x47866860, annotations: 0x0, tlName: "cyc3.myCycle"}) - fillObject("cycleTuple#c867fae3", "#c867fae3", &TLItem{tag: 0xc867fae3, annotations: 0x0, tlName: "cycleTuple"}) - fillObject("halfStr#647ddaf5", "#647ddaf5", &TLItem{tag: 0x647ddaf5, annotations: 0x0, tlName: "halfStr"}) - fillObject("hren#12ab5219", "#12ab5219", &TLItem{tag: 0x12ab5219, annotations: 0x0, tlName: "hren"}) - fillObject("int#a8509bda", "#a8509bda", &TLItem{tag: 0xa8509bda, annotations: 0x0, tlName: "int"}) - fillObject("int32#7934e71f", "#7934e71f", &TLItem{tag: 0x7934e71f, annotations: 0x0, tlName: "int32"}) - fillObject("int64#f5609de0", "#f5609de0", &TLItem{tag: 0xf5609de0, annotations: 0x0, tlName: "int64"}) - fillObject("long#22076cba", "#22076cba", &TLItem{tag: 0x22076cba, annotations: 0x0, tlName: "long"}) - fillObject("maybeTest1#c457763c", "#c457763c", &TLItem{tag: 0xc457763c, annotations: 0x0, tlName: "maybeTest1"}) - fillObject("multiPoint#0e1ae81e", "#0e1ae81e", &TLItem{tag: 0x0e1ae81e, annotations: 0x0, tlName: "multiPoint"}) - fillObject("myInt32#ba59e151", "#ba59e151", &TLItem{tag: 0xba59e151, annotations: 0x0, tlName: "myInt32"}) - fillObject("myInt64#1d95db9d", "#1d95db9d", &TLItem{tag: 0x1d95db9d, annotations: 0x0, tlName: "myInt64"}) - fillObject("myNat#c60c1b41", "#c60c1b41", &TLItem{tag: 0xc60c1b41, annotations: 0x0, tlName: "myNat"}) - fillObject("myPlus#79e0c6df", "#79e0c6df", &TLItem{tag: 0x79e0c6df, annotations: 0x0, tlName: "myPlus"}) - fillObject("myPlus3#692c291b", "#692c291b", &TLItem{tag: 0x692c291b, annotations: 0x0, tlName: "myPlus3"}) - fillObject("myZero#8d868379", "#8d868379", &TLItem{tag: 0x8d868379, annotations: 0x0, tlName: "myZero"}) - fillObject("myZero3#103a40cf", "#103a40cf", &TLItem{tag: 0x103a40cf, annotations: 0x0, tlName: "myZero3"}) - fillObject("nativeWrappers#344ddf50", "#344ddf50", &TLItem{tag: 0x344ddf50, annotations: 0x0, tlName: "nativeWrappers"}) - fillObject("noStr#3a728324", "#3a728324", &TLItem{tag: 0x3a728324, annotations: 0x0, tlName: "noStr"}) - fillObject("replace#323db63e", "#323db63e", &TLItem{tag: 0x323db63e, annotations: 0x0, tlName: "replace"}) - fillObject("replace10#fc81f008", "#fc81f008", &TLItem{tag: 0xfc81f008, annotations: 0x0, tlName: "replace10"}) - fillObject("replace12#ec121094", "#ec121094", &TLItem{tag: 0xec121094, annotations: 0x0, tlName: "replace12"}) - fillObject("replace15#2280e430", "#2280e430", &TLItem{tag: 0x2280e430, annotations: 0x0, tlName: "replace15"}) - fillObject("replace17#f46f9b9b", "#f46f9b9b", &TLItem{tag: 0xf46f9b9b, annotations: 0x0, tlName: "replace17"}) - fillObject("replace18#704dd712", "#704dd712", &TLItem{tag: 0x704dd712, annotations: 0x0, tlName: "replace18"}) - fillObject("replace2#e2d4ebee", "#e2d4ebee", &TLItem{tag: 0xe2d4ebee, annotations: 0x0, tlName: "replace2"}) - fillObject("replace3#51e324e4", "#51e324e4", &TLItem{tag: 0x51e324e4, annotations: 0x0, tlName: "replace3"}) - fillObject("replace5#8b5bc78a", "#8b5bc78a", &TLItem{tag: 0x8b5bc78a, annotations: 0x0, tlName: "replace5"}) - fillObject("replace6#abd49d06", "#abd49d06", &TLItem{tag: 0xabd49d06, annotations: 0x0, tlName: "replace6"}) - fillObject("replace7#f4c66d9f", "#f4c66d9f", &TLItem{tag: 0xf4c66d9f, annotations: 0x0, tlName: "replace7"}) - fillObject("replace8#d626c117", "#d626c117", &TLItem{tag: 0xd626c117, annotations: 0x0, tlName: "replace8"}) - fillObject("replace9#95d598c5", "#95d598c5", &TLItem{tag: 0x95d598c5, annotations: 0x0, tlName: "replace9"}) - fillObject("service5.emptyOutput#ff8f7db8", "#ff8f7db8", &TLItem{tag: 0xff8f7db8, annotations: 0x0, tlName: "service5.emptyOutput"}) - fillFunction("service5.insert#7cf362ba", "#7cf362ba", &TLItem{tag: 0x7cf362ba, annotations: 0x2, tlName: "service5.insert"}) - fillObject("service5Long.emptyOutput#ff8f7db9", "#ff8f7db9", &TLItem{tag: 0xff8f7db9, annotations: 0x0, tlName: "service5Long.emptyOutput"}) - fillFunction("service5Long.insert#7cf362bb", "#7cf362bb", &TLItem{tag: 0x7cf362bb, annotations: 0x2, tlName: "service5Long.insert"}) - fillObject("service5Long.stringOutput#dc170ff5", "#dc170ff5", &TLItem{tag: 0xdc170ff5, annotations: 0x0, tlName: "service5Long.stringOutput"}) - fillObject("service5.stringOutput#dc170ff4", "#dc170ff4", &TLItem{tag: 0xdc170ff4, annotations: 0x0, tlName: "service5.stringOutput"}) - fillObject("string#b5286e24", "#b5286e24", &TLItem{tag: 0xb5286e24, annotations: 0x0, tlName: "string"}) - fillObject("testMaybe#88920e90", "#88920e90", &TLItem{tag: 0x88920e90, annotations: 0x0, tlName: "testMaybe"}) - fillObject("testMaybe2#0aa03cf2", "#0aa03cf2", &TLItem{tag: 0x0aa03cf2, annotations: 0x0, tlName: "testMaybe2"}) - fillObject("true#3fedd339", "#3fedd339", &TLItem{tag: 0x3fedd339, annotations: 0x0, tlName: "true"}) - fillObject("typeA#157673c1", "#157673c1", &TLItem{tag: 0x157673c1, annotations: 0x0, tlName: "typeA"}) - fillObject("typeB#9d024802", "#9d024802", &TLItem{tag: 0x9d024802, annotations: 0x0, tlName: "typeB"}) - fillObject("typeC#6b8ef43f", "#6b8ef43f", &TLItem{tag: 0x6b8ef43f, annotations: 0x0, tlName: "typeC"}) - fillObject("typeD#b1f4369e", "#b1f4369e", &TLItem{tag: 0xb1f4369e, annotations: 0x0, tlName: "typeD"}) - fillObject("unionArgsUse#742161d2", "#742161d2", &TLItem{tag: 0x742161d2, annotations: 0x0, tlName: "unionArgsUse"}) - fillObject("useDictUgly#fb9ce817", "#fb9ce817", &TLItem{tag: 0xfb9ce817, annotations: 0x0, tlName: "useDictUgly"}) - fillObject("useResponse#0a63ec5f", "#0a63ec5f", &TLItem{tag: 0x0a63ec5f, annotations: 0x0, tlName: "useResponse"}) - fillObject("useStr#9aa3dee5", "#9aa3dee5", &TLItem{tag: 0x9aa3dee5, annotations: 0x0, tlName: "useStr"}) - fillObject("useTrue#dfdd4180", "#dfdd4180", &TLItem{tag: 0xdfdd4180, annotations: 0x0, tlName: "useTrue"}) - fillFunction("usefulService.getUserEntity#3c857e52", "#3c857e52", &TLItem{tag: 0x3c857e52, annotations: 0x2, tlName: "usefulService.getUserEntity"}) + fillObject("a.blue#623360f3", "#623360f3", &TLItem{tag: 0x623360f3, annotations: 0x0, tlName: "a.blue", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("a.color#f35d7a69", "#f35d7a69", &TLItem{tag: 0xf35d7a69, annotations: 0x0, tlName: "a.color", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("a.green#6127e7b8", "#6127e7b8", &TLItem{tag: 0x6127e7b8, annotations: 0x0, tlName: "a.green", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("a.red#b83a723d", "#b83a723d", &TLItem{tag: 0xb83a723d, annotations: 0x0, tlName: "a.red", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("a.top2#7082d18f", "#7082d18f", &TLItem{tag: 0x7082d18f, annotations: 0x0, tlName: "a.top2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("a.uNionA#a7662843", "#a7662843", &TLItem{tag: 0xa7662843, annotations: 0x0, tlName: "a.uNionA", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.alias#944aaa97", "#944aaa97", &TLItem{tag: 0x944aaa97, annotations: 0x0, tlName: "ab.alias", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call1#20c5fb2d", "#20c5fb2d", &TLItem{tag: 0x20c5fb2d, annotations: 0x1, tlName: "ab.call1", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call10#8db2a4f8", "#8db2a4f8", &TLItem{tag: 0x8db2a4f8, annotations: 0x1, tlName: "ab.call10", resultTypeContainsUnionTypes: true, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call11#ecb2a36c", "#ecb2a36c", &TLItem{tag: 0xecb2a36c, annotations: 0x1, tlName: "ab.call11", resultTypeContainsUnionTypes: true, argumentsTypesContainUnionTypes: true}) + fillFunction("ab.call2#77d5f057", "#77d5f057", &TLItem{tag: 0x77d5f057, annotations: 0x1, tlName: "ab.call2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call3#0a083445", "#0a083445", &TLItem{tag: 0x0a083445, annotations: 0x1, tlName: "ab.call3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call4#c1220a1e", "#c1220a1e", &TLItem{tag: 0xc1220a1e, annotations: 0x1, tlName: "ab.call4", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call5#7ba4d28d", "#7ba4d28d", &TLItem{tag: 0x7ba4d28d, annotations: 0x1, tlName: "ab.call5", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call6#84d815cb", "#84d815cb", &TLItem{tag: 0x84d815cb, annotations: 0x1, tlName: "ab.call6", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call7#46ec10bf", "#46ec10bf", &TLItem{tag: 0x46ec10bf, annotations: 0x1, tlName: "ab.call7", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call8#1b8652d9", "#1b8652d9", &TLItem{tag: 0x1b8652d9, annotations: 0x1, tlName: "ab.call8", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("ab.call9#75de906c", "#75de906c", &TLItem{tag: 0x75de906c, annotations: 0x1, tlName: "ab.call9", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.code#7651b1ac", "#7651b1ac", &TLItem{tag: 0x7651b1ac, annotations: 0x0, tlName: "ab.code", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.counterChangeRequestPeriodsMany#14a35d80", "#14a35d80", &TLItem{tag: 0x14a35d80, annotations: 0x0, tlName: "ab.counterChangeRequestPeriodsMany", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.counterChangeRequestPeriodsOne#d9c36de5", "#d9c36de5", &TLItem{tag: 0xd9c36de5, annotations: 0x0, tlName: "ab.counterChangeRequestPeriodsOne", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.empty#1ec6a63e", "#1ec6a63e", &TLItem{tag: 0x1ec6a63e, annotations: 0x0, tlName: "ab.empty", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.myType#e0e96c86", "#e0e96c86", &TLItem{tag: 0xe0e96c86, annotations: 0x0, tlName: "ab.myType", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.testMaybe#4dac492a", "#4dac492a", &TLItem{tag: 0x4dac492a, annotations: 0x0, tlName: "ab.testMaybe", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.topLevel1#e67bce28", "#e67bce28", &TLItem{tag: 0xe67bce28, annotations: 0x0, tlName: "ab.topLevel1", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.topLevel2#cef933fb", "#cef933fb", &TLItem{tag: 0xcef933fb, annotations: 0x0, tlName: "ab.topLevel2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.typeA#a99fef6a", "#a99fef6a", &TLItem{tag: 0xa99fef6a, annotations: 0x0, tlName: "ab.typeA", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.typeB#ff2e6d58", "#ff2e6d58", &TLItem{tag: 0xff2e6d58, annotations: 0x0, tlName: "ab.typeB", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.typeC#69920d6e", "#69920d6e", &TLItem{tag: 0x69920d6e, annotations: 0x0, tlName: "ab.typeC", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.typeD#76615bf1", "#76615bf1", &TLItem{tag: 0x76615bf1, annotations: 0x0, tlName: "ab.typeD", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.useCycle#71687381", "#71687381", &TLItem{tag: 0x71687381, annotations: 0x0, tlName: "ab.useCycle", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("ab.useDictString#3325d884", "#3325d884", &TLItem{tag: 0x3325d884, annotations: 0x0, tlName: "ab.useDictString", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("au.nionA#df61f632", "#df61f632", &TLItem{tag: 0xdf61f632, annotations: 0x0, tlName: "au.nionA", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("b.red#a9471844", "#a9471844", &TLItem{tag: 0xa9471844, annotations: 0x0, tlName: "b.red", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call1#a7302fbc", "#a7302fbc", &TLItem{tag: 0xa7302fbc, annotations: 0x1, tlName: "call1", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call2#f02024c6", "#f02024c6", &TLItem{tag: 0xf02024c6, annotations: 0x1, tlName: "call2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call3#6ace6718", "#6ace6718", &TLItem{tag: 0x6ace6718, annotations: 0x1, tlName: "call3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call4#46d7de8f", "#46d7de8f", &TLItem{tag: 0x46d7de8f, annotations: 0x1, tlName: "call4", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call5#fc51061c", "#fc51061c", &TLItem{tag: 0xfc51061c, annotations: 0x1, tlName: "call5", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call6#e41e4696", "#e41e4696", &TLItem{tag: 0xe41e4696, annotations: 0x1, tlName: "call6", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call7#262a43e2", "#262a43e2", &TLItem{tag: 0x262a43e2, annotations: 0x1, tlName: "call7", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call8#7b400184", "#7b400184", &TLItem{tag: 0x7b400184, annotations: 0x1, tlName: "call8", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("call9#67a0d62d", "#67a0d62d", &TLItem{tag: 0x67a0d62d, annotations: 0x1, tlName: "call9", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.myType#eab6a6b4", "#eab6a6b4", &TLItem{tag: 0xeab6a6b4, annotations: 0x0, tlName: "cd.myType", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.response#8c202f64", "#8c202f64", &TLItem{tag: 0x8c202f64, annotations: 0x0, tlName: "cd.response", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.topLevel3#5cd1ca89", "#5cd1ca89", &TLItem{tag: 0x5cd1ca89, annotations: 0x0, tlName: "cd.topLevel3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.typeA#a831a920", "#a831a920", &TLItem{tag: 0xa831a920, annotations: 0x0, tlName: "cd.typeA", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.typeB#377b4996", "#377b4996", &TLItem{tag: 0x377b4996, annotations: 0x0, tlName: "cd.typeB", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.typeC#db0f93d4", "#db0f93d4", &TLItem{tag: 0xdb0f93d4, annotations: 0x0, tlName: "cd.typeC", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.typeD#b5528285", "#b5528285", &TLItem{tag: 0xb5528285, annotations: 0x0, tlName: "cd.typeD", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cd.useCycle#6ed67ca0", "#6ed67ca0", &TLItem{tag: 0x6ed67ca0, annotations: 0x0, tlName: "cd.useCycle", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cyc1.myCycle#136ecc9e", "#136ecc9e", &TLItem{tag: 0x136ecc9e, annotations: 0x0, tlName: "cyc1.myCycle", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cyc2.myCycle#fba5eecb", "#fba5eecb", &TLItem{tag: 0xfba5eecb, annotations: 0x0, tlName: "cyc2.myCycle", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cyc3.myCycle#47866860", "#47866860", &TLItem{tag: 0x47866860, annotations: 0x0, tlName: "cyc3.myCycle", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("cycleTuple#c867fae3", "#c867fae3", &TLItem{tag: 0xc867fae3, annotations: 0x0, tlName: "cycleTuple", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("halfStr#647ddaf5", "#647ddaf5", &TLItem{tag: 0x647ddaf5, annotations: 0x0, tlName: "halfStr", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("hren#12ab5219", "#12ab5219", &TLItem{tag: 0x12ab5219, annotations: 0x0, tlName: "hren", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("int#a8509bda", "#a8509bda", &TLItem{tag: 0xa8509bda, annotations: 0x0, tlName: "int", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("int32#7934e71f", "#7934e71f", &TLItem{tag: 0x7934e71f, annotations: 0x0, tlName: "int32", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("int64#f5609de0", "#f5609de0", &TLItem{tag: 0xf5609de0, annotations: 0x0, tlName: "int64", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("long#22076cba", "#22076cba", &TLItem{tag: 0x22076cba, annotations: 0x0, tlName: "long", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("maybeTest1#c457763c", "#c457763c", &TLItem{tag: 0xc457763c, annotations: 0x0, tlName: "maybeTest1", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("multiPoint#0e1ae81e", "#0e1ae81e", &TLItem{tag: 0x0e1ae81e, annotations: 0x0, tlName: "multiPoint", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myInt32#ba59e151", "#ba59e151", &TLItem{tag: 0xba59e151, annotations: 0x0, tlName: "myInt32", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myInt64#1d95db9d", "#1d95db9d", &TLItem{tag: 0x1d95db9d, annotations: 0x0, tlName: "myInt64", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myNat#c60c1b41", "#c60c1b41", &TLItem{tag: 0xc60c1b41, annotations: 0x0, tlName: "myNat", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myPlus#79e0c6df", "#79e0c6df", &TLItem{tag: 0x79e0c6df, annotations: 0x0, tlName: "myPlus", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myPlus3#692c291b", "#692c291b", &TLItem{tag: 0x692c291b, annotations: 0x0, tlName: "myPlus3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myZero#8d868379", "#8d868379", &TLItem{tag: 0x8d868379, annotations: 0x0, tlName: "myZero", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("myZero3#103a40cf", "#103a40cf", &TLItem{tag: 0x103a40cf, annotations: 0x0, tlName: "myZero3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("nativeWrappers#344ddf50", "#344ddf50", &TLItem{tag: 0x344ddf50, annotations: 0x0, tlName: "nativeWrappers", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("noStr#3a728324", "#3a728324", &TLItem{tag: 0x3a728324, annotations: 0x0, tlName: "noStr", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace#323db63e", "#323db63e", &TLItem{tag: 0x323db63e, annotations: 0x0, tlName: "replace", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace10#fc81f008", "#fc81f008", &TLItem{tag: 0xfc81f008, annotations: 0x0, tlName: "replace10", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace12#ec121094", "#ec121094", &TLItem{tag: 0xec121094, annotations: 0x0, tlName: "replace12", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace15#2280e430", "#2280e430", &TLItem{tag: 0x2280e430, annotations: 0x0, tlName: "replace15", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace17#f46f9b9b", "#f46f9b9b", &TLItem{tag: 0xf46f9b9b, annotations: 0x0, tlName: "replace17", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace18#704dd712", "#704dd712", &TLItem{tag: 0x704dd712, annotations: 0x0, tlName: "replace18", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace2#e2d4ebee", "#e2d4ebee", &TLItem{tag: 0xe2d4ebee, annotations: 0x0, tlName: "replace2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace3#51e324e4", "#51e324e4", &TLItem{tag: 0x51e324e4, annotations: 0x0, tlName: "replace3", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace5#8b5bc78a", "#8b5bc78a", &TLItem{tag: 0x8b5bc78a, annotations: 0x0, tlName: "replace5", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace6#abd49d06", "#abd49d06", &TLItem{tag: 0xabd49d06, annotations: 0x0, tlName: "replace6", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace7#f4c66d9f", "#f4c66d9f", &TLItem{tag: 0xf4c66d9f, annotations: 0x0, tlName: "replace7", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace8#d626c117", "#d626c117", &TLItem{tag: 0xd626c117, annotations: 0x0, tlName: "replace8", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("replace9#95d598c5", "#95d598c5", &TLItem{tag: 0x95d598c5, annotations: 0x0, tlName: "replace9", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("service5.emptyOutput#ff8f7db8", "#ff8f7db8", &TLItem{tag: 0xff8f7db8, annotations: 0x0, tlName: "service5.emptyOutput", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("service5.insert#7cf362ba", "#7cf362ba", &TLItem{tag: 0x7cf362ba, annotations: 0x2, tlName: "service5.insert", resultTypeContainsUnionTypes: true, argumentsTypesContainUnionTypes: false}) + fillFunction("service5.insertList#7cf362bc", "#7cf362bc", &TLItem{tag: 0x7cf362bc, annotations: 0x2, tlName: "service5.insertList", resultTypeContainsUnionTypes: true, argumentsTypesContainUnionTypes: false}) + fillObject("service5Long.emptyOutput#ff8f7db9", "#ff8f7db9", &TLItem{tag: 0xff8f7db9, annotations: 0x0, tlName: "service5Long.emptyOutput", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("service5Long.insert#7cf362bb", "#7cf362bb", &TLItem{tag: 0x7cf362bb, annotations: 0x2, tlName: "service5Long.insert", resultTypeContainsUnionTypes: true, argumentsTypesContainUnionTypes: false}) + fillObject("service5Long.stringOutput#dc170ff5", "#dc170ff5", &TLItem{tag: 0xdc170ff5, annotations: 0x0, tlName: "service5Long.stringOutput", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("service5.stringOutput#dc170ff4", "#dc170ff4", &TLItem{tag: 0xdc170ff4, annotations: 0x0, tlName: "service5.stringOutput", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("string#b5286e24", "#b5286e24", &TLItem{tag: 0xb5286e24, annotations: 0x0, tlName: "string", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("testMaybe#88920e90", "#88920e90", &TLItem{tag: 0x88920e90, annotations: 0x0, tlName: "testMaybe", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("testMaybe2#0aa03cf2", "#0aa03cf2", &TLItem{tag: 0x0aa03cf2, annotations: 0x0, tlName: "testMaybe2", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("true#3fedd339", "#3fedd339", &TLItem{tag: 0x3fedd339, annotations: 0x0, tlName: "true", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("typeA#157673c1", "#157673c1", &TLItem{tag: 0x157673c1, annotations: 0x0, tlName: "typeA", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("typeB#9d024802", "#9d024802", &TLItem{tag: 0x9d024802, annotations: 0x0, tlName: "typeB", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("typeC#6b8ef43f", "#6b8ef43f", &TLItem{tag: 0x6b8ef43f, annotations: 0x0, tlName: "typeC", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("typeD#b1f4369e", "#b1f4369e", &TLItem{tag: 0xb1f4369e, annotations: 0x0, tlName: "typeD", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("unionArgsUse#742161d2", "#742161d2", &TLItem{tag: 0x742161d2, annotations: 0x0, tlName: "unionArgsUse", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("useDictUgly#fb9ce817", "#fb9ce817", &TLItem{tag: 0xfb9ce817, annotations: 0x0, tlName: "useDictUgly", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("useResponse#0a63ec5f", "#0a63ec5f", &TLItem{tag: 0x0a63ec5f, annotations: 0x0, tlName: "useResponse", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("useStr#9aa3dee5", "#9aa3dee5", &TLItem{tag: 0x9aa3dee5, annotations: 0x0, tlName: "useStr", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillObject("useTrue#dfdd4180", "#dfdd4180", &TLItem{tag: 0xdfdd4180, annotations: 0x0, tlName: "useTrue", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) + fillFunction("usefulService.getUserEntity#3c857e52", "#3c857e52", &TLItem{tag: 0x3c857e52, annotations: 0x2, tlName: "usefulService.getUserEntity", resultTypeContainsUnionTypes: false, argumentsTypesContainUnionTypes: false}) } diff --git a/internal/tlcodegen/test/gen/goldmaster_nosplit/tl/tl.go b/internal/tlcodegen/test/gen/goldmaster_nosplit/tl/tl.go index 1afc6780..73907a4b 100644 --- a/internal/tlcodegen/test/gen/goldmaster_nosplit/tl/tl.go +++ b/internal/tlcodegen/test/gen/goldmaster_nosplit/tl/tl.go @@ -50,6 +50,7 @@ type ( Int64 = internal.Int64 IntBoxedMaybe = internal.IntBoxedMaybe IntMaybe = internal.IntMaybe + ListService5Output = internal.ListService5Output Long = internal.Long MaybeTest1 = internal.MaybeTest1 MaybeWrapperInt3 = internal.MaybeWrapperInt3 diff --git a/internal/tlcodegen/test/gen/goldmaster_nosplit/tlab/tlab.go b/internal/tlcodegen/test/gen/goldmaster_nosplit/tlab/tlab.go index 930b4849..77463c2b 100644 --- a/internal/tlcodegen/test/gen/goldmaster_nosplit/tlab/tlab.go +++ b/internal/tlcodegen/test/gen/goldmaster_nosplit/tlab/tlab.go @@ -14,6 +14,8 @@ import ( type ( Alias = internal.AbAlias Call1 = internal.AbCall1 + Call10 = internal.AbCall10 + Call11 = internal.AbCall11 Call2 = internal.AbCall2 Call3 = internal.AbCall3 Call4 = internal.AbCall4 diff --git a/internal/tlcodegen/test/gen/goldmaster_nosplit/tljson.html b/internal/tlcodegen/test/gen/goldmaster_nosplit/tljson.html index 4947b156..d0ffeacc 100644 --- a/internal/tlcodegen/test/gen/goldmaster_nosplit/tljson.html +++ b/internal/tlcodegen/test/gen/goldmaster_nosplit/tljson.html @@ -21,6 +21,16 @@

    Functions

    ab.call1ab.TypeB
  • +
  • + + ab.call10 + → a.Color +
  • +
  • + + ab.call11 + → a.Color +
  • ab.call2 @@ -111,6 +121,11 @@

    Functions

    service5.insertservice5.Output
  • +
  • + + service5.insertList + → List<service5.Output> +
  • service5Long.insert @@ -411,6 +426,46 @@

    ab.call1

    +

    ab.call10

    + +

    + Returns a.Color +
    +
    JSON
    +
    + {} +
    +
    TL
    +
    + read ab.call10#8db2a4f8 = a.Color; +
    +
    + +

    ab.call11

    + +

    + Returns a.Color +
    +
    JSON
    +
    + { + + + + + + + +
      "x": a.Color +
    + } +
    +
    TL
    +
    + read ab.call11#ecb2a36c x:a.Color = a.Color; +
    +
    +

    ab.call2

    @@ -2399,6 +2454,47 @@

    Maybe<int>

    +

    list<service5.Output>

    + //---- test recursive struct without union as result
    + +

    +
    +
    JSON
    +
    + { + + + + + + + + + + + + + + + + + + + +
      "flag": <uint32>, +
      "head": service5.Output,// flag bit #0 + +
      "tail": list<service5.Output>// flag bit #0 + +
    + } +
    +
    TL
    +
    + list#02d80cdd {X:Type} flag:# head:flag.0?X tail:flag.0?(list X) = List X; +
    +
    +

    maybeTest1

    @@ -4092,6 +4188,39 @@

    service5.insert

    +

    service5.insertList

    + +

    + Returns List<service5.Output> +
    +
    JSON
    +
    + { + + + + + + + + + + + + + +
      "flags": <uint32>, +
      "persistent": true// flags bit #0 + +
    + } +
    +
    TL
    +
    + readwrite service5.insertList#7cf362bc flags:# persistent:flags.0?%True = (List service5.Output); +
    +
    +

    service5Long.insert

    diff --git a/internal/tlcodegen/test/gen/goldmaster_nosplit/tlservice5/tlservice5.go b/internal/tlcodegen/test/gen/goldmaster_nosplit/tlservice5/tlservice5.go index 5ad34f48..53af6873 100644 --- a/internal/tlcodegen/test/gen/goldmaster_nosplit/tlservice5/tlservice5.go +++ b/internal/tlcodegen/test/gen/goldmaster_nosplit/tlservice5/tlservice5.go @@ -14,6 +14,7 @@ import ( type ( EmptyOutput = internal.Service5EmptyOutput Insert = internal.Service5Insert + InsertList = internal.Service5InsertList Output = internal.Service5Output StringOutput = internal.Service5StringOutput ) diff --git a/internal/tlcodegen/test/tls/goldmaster.tl b/internal/tlcodegen/test/tls/goldmaster.tl index ceaf29bc..8537e907 100644 --- a/internal/tlcodegen/test/tls/goldmaster.tl +++ b/internal/tlcodegen/test/tls/goldmaster.tl @@ -50,6 +50,9 @@ dictionaryAny#1f4c6190 {k:Type} {v:Type} # [(dictionaryFieldAny k v)] = Dictiona true = True; // this can be used as void type and serialized to empty array in PHP useTrue#dfdd4180 fm:# a:fm.0?true b:fm.1?True c:true d:True e:fm.2?Bool = UseTrue; // we give warnings for many fields of this kind +//---- test recursive struct without union as result +list {X:Type} flag:# head:flag.0?X tail:flag.0?(list X) = List X; + //---- test bytes version propagation noStr x:int = NoStr; useStr x:string = UseStr; @@ -260,5 +263,7 @@ service5Long.stringOutput#dc170ff5 http_code:long response:string = service5Long @read ab.call7 x:typeA => ab.TypeB; @read ab.call8 x:typeA => cd.TypeB; @read ab.call9 x:typeA => TypeB; +@read ab.call10 => a.Color; +@read ab.call11 x:a.Color => a.Color; // @write logs2.addIndex type_id:int field:%String => Bool; // Test that %String is canonically resolved into primitive string diff --git a/internal/tlcodegen/test/tls/goldmaster2.tl b/internal/tlcodegen/test/tls/goldmaster2.tl index 87a2947c..099e9ac0 100644 --- a/internal/tlcodegen/test/tls/goldmaster2.tl +++ b/internal/tlcodegen/test/tls/goldmaster2.tl @@ -10,6 +10,8 @@ @read call9 x:typeA = TypeB; @readwrite service5.insert#7cf362ba flags:# persistent:flags.0?%True = service5.Output; +@readwrite service5.insertList#7cf362bc flags:# persistent:flags.0?%True = List; + @readwrite service5Long.insert#7cf362bb flags:# persistent:flags.0?%True = service5Long.Output; ---types--- diff --git a/internal/tlcodegen/test/tls/goldmaster_canonical.tl b/internal/tlcodegen/test/tls/goldmaster_canonical.tl index 3a9b415e..1bd5d173 100644 --- a/internal/tlcodegen/test/tls/goldmaster_canonical.tl +++ b/internal/tlcodegen/test/tls/goldmaster_canonical.tl @@ -24,6 +24,7 @@ dictionaryFieldAny#2c43a65b k:Type v:Type key:k value:v = DictionaryFieldAny k v dictionaryAny#1f4c6190 k:Type v:Type # [ (dictionaryFieldAny k v) ] = DictionaryAny k v // ./internal/tlcodegen/test/tls/goldmaster.tl true#3fedd339 = True // ./internal/tlcodegen/test/tls/goldmaster.tl useTrue#dfdd4180 fm:# a:fm.0?true b:fm.1?True c:true d:True e:fm.2?Bool = UseTrue // ./internal/tlcodegen/test/tls/goldmaster.tl +list#02d80cdd X:Type flag:# head:flag.0?X tail:flag.0?list X = List X // ./internal/tlcodegen/test/tls/goldmaster.tl noStr#3a728324 x:int = NoStr // ./internal/tlcodegen/test/tls/goldmaster.tl useStr#9aa3dee5 x:string = UseStr // ./internal/tlcodegen/test/tls/goldmaster.tl halfStr#647ddaf5 x:noStr y:useStr = HalfStr // ./internal/tlcodegen/test/tls/goldmaster.tl @@ -123,6 +124,8 @@ service5Long.stringOutput#dc170ff5 http_code:long response:string = service5Long @read ab.call7#46ec10bf x:typeA = ab.TypeB // ./internal/tlcodegen/test/tls/goldmaster.tl @read ab.call8#1b8652d9 x:typeA = cd.TypeB // ./internal/tlcodegen/test/tls/goldmaster.tl @read ab.call9#75de906c x:typeA = TypeB // ./internal/tlcodegen/test/tls/goldmaster.tl +@read ab.call10#8db2a4f8 = a.Color // ./internal/tlcodegen/test/tls/goldmaster.tl +@read ab.call11#ecb2a36c x:a.Color = a.Color // ./internal/tlcodegen/test/tls/goldmaster.tl @read call1#a7302fbc x:ab.typeA = ab.TypeB // ./internal/tlcodegen/test/tls/goldmaster2.tl @read call2#f02024c6 x:ab.typeA = cd.TypeB // ./internal/tlcodegen/test/tls/goldmaster2.tl @read call3#6ace6718 x:ab.typeA = TypeB // ./internal/tlcodegen/test/tls/goldmaster2.tl @@ -133,5 +136,6 @@ service5Long.stringOutput#dc170ff5 http_code:long response:string = service5Long @read call8#7b400184 x:typeA = cd.TypeB // ./internal/tlcodegen/test/tls/goldmaster2.tl @read call9#67a0d62d x:typeA = TypeB // ./internal/tlcodegen/test/tls/goldmaster2.tl @readwrite service5.insert#7cf362ba flags:# persistent:flags.0?%True = service5.Output // ./internal/tlcodegen/test/tls/goldmaster2.tl +@readwrite service5.insertList#7cf362bc flags:# persistent:flags.0?%True = List service5.Output // ./internal/tlcodegen/test/tls/goldmaster2.tl @readwrite service5Long.insert#7cf362bb flags:# persistent:flags.0?%True = service5Long.Output // ./internal/tlcodegen/test/tls/goldmaster2.tl aaa#05b0e500 A:# T:Type U:Type a:# B:# A0:A.0?string A1:A.1?string a0:a.0?string a1:a.1?string B0:B.0?string B1:B.1?U = Aaa A T U // ./internal/tlcodegen/test/tls/goldmaster3.tl diff --git a/internal/tlcodegen/type_rw.go b/internal/tlcodegen/type_rw.go index 753c86cc..4373c7b0 100644 --- a/internal/tlcodegen/type_rw.go +++ b/internal/tlcodegen/type_rw.go @@ -165,6 +165,31 @@ func (w *TypeRWWrapper) AnnotationsMask() uint32 { return mask } +func (w *TypeRWWrapper) DoArgumentsContainUnionTypes() bool { + if w, ok := w.trw.(*TypeRWStruct); ok && w.ResultType != nil { + return w.wr.containsUnion(map[*TypeRWWrapper]bool{}) + } else { + return false + } +} + +func (w *TypeRWWrapper) DoesReturnTypeContainUnionTypes() bool { + if w, ok := w.trw.(*TypeRWStruct); ok && w.ResultType != nil { + return w.ResultType.containsUnion(map[*TypeRWWrapper]bool{}) + } else { + return false + } +} + +func (w *TypeRWWrapper) containsUnion(visitedNodes map[*TypeRWWrapper]bool) bool { + if _, ok := visitedNodes[w]; !ok { + visitedNodes[w] = false + return w.trw.ContainsUnion(visitedNodes) + } else { + return false + } +} + // Assign structural names to external arguments func (w *TypeRWWrapper) NatArgs(result []ActualNatArg, prefix string) []ActualNatArg { for i, a := range w.arguments { @@ -709,6 +734,7 @@ type TypeRW interface { AllPossibleRecursionProducers() []*TypeRWWrapper AllTypeDependencies(generic, countFunctions bool) []*TypeRWWrapper IsWrappingType() bool + ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool BeforeCodeGenerationStep1() // during first phase, some wr.trw are nil due to recursive types. So we delay some BeforeCodeGenerationStep2() // during second phase, union fields recursive bit is set diff --git a/internal/tlcodegen/type_rw_bool.go b/internal/tlcodegen/type_rw_bool.go index cf6b578d..5093806d 100644 --- a/internal/tlcodegen/type_rw_bool.go +++ b/internal/tlcodegen/type_rw_bool.go @@ -54,6 +54,10 @@ func (trw *TypeRWBool) IsWrappingType() bool { return true } +func (trw *TypeRWBool) ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool { + return false +} + func (trw *TypeRWBool) FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]int, generic bool) { } diff --git a/internal/tlcodegen/type_rw_maybe.go b/internal/tlcodegen/type_rw_maybe.go index 0df7ff30..b2068e4f 100644 --- a/internal/tlcodegen/type_rw_maybe.go +++ b/internal/tlcodegen/type_rw_maybe.go @@ -55,6 +55,10 @@ func (trw *TypeRWMaybe) IsWrappingType() bool { return true } +func (trw *TypeRWMaybe) ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool { + return trw.element.t.containsUnion(visitedNodes) +} + func (trw *TypeRWMaybe) FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]int, generic bool) { visitedNodes[trw.wr] = 1 trw.element.t.trw.FillRecursiveChildren(visitedNodes, generic) diff --git a/internal/tlcodegen/type_rw_primitive.go b/internal/tlcodegen/type_rw_primitive.go index 2f3ee4d2..b789a0ab 100644 --- a/internal/tlcodegen/type_rw_primitive.go +++ b/internal/tlcodegen/type_rw_primitive.go @@ -70,6 +70,10 @@ func (trw *TypeRWPrimitive) IsWrappingType() bool { return true } +func (trw *TypeRWPrimitive) ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool { + return false +} + func (trw *TypeRWPrimitive) FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]int, generic bool) { } diff --git a/internal/tlcodegen/type_rw_struct.go b/internal/tlcodegen/type_rw_struct.go index 3b611002..8d4f5058 100644 --- a/internal/tlcodegen/type_rw_struct.go +++ b/internal/tlcodegen/type_rw_struct.go @@ -185,6 +185,15 @@ func (trw *TypeRWStruct) IsWrappingType() bool { return trw.isUnwrapType() } +func (trw *TypeRWStruct) ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool { + for _, f := range trw.Fields { + if f.t.containsUnion(visitedNodes) { + return true + } + } + return false +} + func (trw *TypeRWStruct) FillRecursiveChildren(visitedNodes map[*TypeRWWrapper]int, generic bool) { if visitedNodes[trw.wr] != 0 { return diff --git a/internal/tlcodegen/type_rw_tuple.go b/internal/tlcodegen/type_rw_tuple.go index 8243c24d..77578557 100644 --- a/internal/tlcodegen/type_rw_tuple.go +++ b/internal/tlcodegen/type_rw_tuple.go @@ -108,6 +108,10 @@ func (trw *TypeRWBrackets) IsWrappingType() bool { return false } +func (trw *TypeRWBrackets) ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool { + return trw.element.t.containsUnion(visitedNodes) +} + func (trw *TypeRWBrackets) BeforeCodeGenerationStep1() { if trw.vectorLike { if ok, isString, kf, vf := isDictionaryElement(trw.element.t); ok { diff --git a/internal/tlcodegen/type_rw_union.go b/internal/tlcodegen/type_rw_union.go index 43268787..21e5bf18 100644 --- a/internal/tlcodegen/type_rw_union.go +++ b/internal/tlcodegen/type_rw_union.go @@ -87,6 +87,10 @@ func (trw *TypeRWUnion) IsWrappingType() bool { return false } +func (trw *TypeRWUnion) ContainsUnion(visitedNodes map[*TypeRWWrapper]bool) bool { + return true +} + func (trw *TypeRWUnion) BeforeCodeGenerationStep1() { }