From d9f5ea7de21b1caeff94ddfe40854185427955d5 Mon Sep 17 00:00:00 2001 From: Grigory Buteyko Date: Wed, 17 Jun 2026 11:32:22 +0300 Subject: [PATCH] migration of goldmaster fixed --- internal/pure/migration.go | 16 ++-- .../internal/benchmarks.vruposition.go | 1 + .../gen/casesTL2/internal/cases.myCycle1.go | 1 + .../gen/casesTL2/internal/cases.myCycle2.go | 1 + .../gen/casesTL2/internal/cases.myCycle3.go | 1 + .../cases.testAllPossibleFieldConfigs.go | 1 + ...es.testAllPossibleFieldConfigsContainer.go | 1 + .../cases.testBeforeReadBitValidation.go | 1 + .../internal/cases.testLocalFieldmask.go | 2 + .../cases.testOutFieldMaskContainer.go | 1 + .../internal/cases.testRecursiveFieldMask.go | 3 + .../internal/casesTL2.testFunctionNoDep1.go | 1 + .../internal/casesTL2.testFunctionNoDep2.go | 1 + .../internal/casesTL2.testFunctionNoDep3.go | 1 + .../internal/casesTL2.testFunctionNoDep4.go | 1 + .../internal/casesTL2.testFunctionNoDep5.go | 1 + .../internal/casesTL2.testFunctionNoDep6.go | 1 + .../internal/casesTL2.testFunctionNoDep7.go | 1 + .../internal/casesTL2.testFunctionWithDep1.go | 1 + .../internal/casesTL2.testFunctionWithDep2.go | 1 + .../casesTL2/internal/casesTL2.testObject.go | 1 + .../internal/casesTL2.testParamsGeneration.go | 1 + .../tlcodegen/test/gen/casesTL2/meta/meta.go | 18 ++-- .../gen/casesTL2/tlcasesTL2/tlcasesTL2.go | 43 +++++++-- internal/tlcodegen/test/tls/cases.tl2 | 87 ++++++++++++++----- 25 files changed, 140 insertions(+), 48 deletions(-) diff --git a/internal/pure/migration.go b/internal/pure/migration.go index 75c6b76b3..6fecb0fbb 100644 --- a/internal/pure/migration.go +++ b/internal/pure/migration.go @@ -403,12 +403,14 @@ func (k *Kernel) MigrationTemplateArguments(bb *bytes.Buffer, tip *KernelType, c func (k *Kernel) MigrationFields(bb *bytes.Buffer, migrateTips map[*KernelType]struct{}, tip *KernelType, comb *tlast.Combinator, fieldsAfterReplace []tlast.Field, typesAfterReplace []tlast.TL2TypeRef, indent bool, constructorId int) ([]tlast.TemplateArgument, error) { leftArgs := comb.TemplateArguments - strct, ok := tip.instancesOrdered[0].ins.(*TypeInstanceStruct) - if !ok { - un, isUnion := tip.instancesOrdered[0].ins.(*TypeInstanceUnion) - ok = isUnion - if isUnion { - strct = un.variantTypes[constructorId] + var strct *TypeInstanceStruct + if len(tip.instancesOrdered) != 0 { + strct, _ = tip.instancesOrdered[0].ins.(*TypeInstanceStruct) + if strct == nil { + un, _ := tip.instancesOrdered[0].ins.(*TypeInstanceUnion) + if un != nil { + strct = un.variantTypes[constructorId] + } } } @@ -419,7 +421,7 @@ func (k *Kernel) MigrationFields(bb *bytes.Buffer, migrateTips map[*KernelType]s } commentBefore := fieldDef.CommentBefore - if ok { + if strct != nil { usages := strct.GetNatFieldUsage(i, true, false) usedBits := usages.UsedBits() if len(usedBits) > 0 { diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/benchmarks.vruposition.go b/internal/tlcodegen/test/gen/casesTL2/internal/benchmarks.vruposition.go index 505b2a74a..c34fced15 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/benchmarks.vruposition.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/benchmarks.vruposition.go @@ -14,6 +14,7 @@ import ( var _ = basictl.NatWrite type BenchmarksVruposition struct { + // tlgen:tl1mask:"0,1,3,5,14,15" FieldsMask uint32 // we set this bit only if block with this bit set is committed, so we have no more than 1 such uncommitted block. // CommitBit bit // Optional, use SetCommitBit diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/cases.myCycle1.go b/internal/tlcodegen/test/gen/casesTL2/internal/cases.myCycle1.go index f09087d15..555977d68 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/cases.myCycle1.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/cases.myCycle1.go @@ -15,6 +15,7 @@ var _ = basictl.NatWrite // BLOCK: TEST RECURSIVE TYPES type CasesMyCycle1 struct { + // tlgen:tl1mask:"0" FieldsMask uint32 A *CasesMyCycle2 // Optional, use SetA tl2mask0 byte diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/cases.myCycle2.go b/internal/tlcodegen/test/gen/casesTL2/internal/cases.myCycle2.go index 4dab65878..a94d54662 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/cases.myCycle2.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/cases.myCycle2.go @@ -14,6 +14,7 @@ import ( var _ = basictl.NatWrite type CasesMyCycle2 struct { + // tlgen:tl1mask:"0" FieldsMask uint32 A CasesMyCycle3 // Optional, use SetA tl2mask0 byte diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/cases.myCycle3.go b/internal/tlcodegen/test/gen/casesTL2/internal/cases.myCycle3.go index ce860ef7e..12c485d72 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/cases.myCycle3.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/cases.myCycle3.go @@ -14,6 +14,7 @@ import ( var _ = basictl.NatWrite type CasesMyCycle3 struct { + // tlgen:tl1mask:"0" FieldsMask uint32 A CasesMyCycle1 // Optional, use SetA tl2mask0 byte diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/cases.testAllPossibleFieldConfigs.go b/internal/tlcodegen/test/gen/casesTL2/internal/cases.testAllPossibleFieldConfigs.go index 25fa134aa..23f256421 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/cases.testAllPossibleFieldConfigs.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/cases.testAllPossibleFieldConfigs.go @@ -14,6 +14,7 @@ import ( var _ = basictl.NatWrite type CasesTestAllPossibleFieldConfigs struct { + // tlgen:tl1mask:"0,1,2,3" Local uint32 Locals uint32 // no fieldmask, no nat dependencies in type diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/cases.testAllPossibleFieldConfigsContainer.go b/internal/tlcodegen/test/gen/casesTL2/internal/cases.testAllPossibleFieldConfigsContainer.go index f998f6e4c..311d15130 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/cases.testAllPossibleFieldConfigsContainer.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/cases.testAllPossibleFieldConfigsContainer.go @@ -14,6 +14,7 @@ import ( var _ = basictl.NatWrite type CasesTestAllPossibleFieldConfigsContainer struct { + // tlgen:tl1mask:"0,1,2,3" Outer uint32 Outers uint32 Value CasesTestAllPossibleFieldConfigs diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/cases.testBeforeReadBitValidation.go b/internal/tlcodegen/test/gen/casesTL2/internal/cases.testBeforeReadBitValidation.go index 19a46d98a..66a5a8ab5 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/cases.testBeforeReadBitValidation.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/cases.testBeforeReadBitValidation.go @@ -14,6 +14,7 @@ import ( var _ = basictl.NatWrite type CasesTestBeforeReadBitValidation struct { + // tlgen:tl1mask:"0,1" N uint32 Ns uint32 A []int32 // Optional, use SetA diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/cases.testLocalFieldmask.go b/internal/tlcodegen/test/gen/casesTL2/internal/cases.testLocalFieldmask.go index 767a1eaeb..771c5bef4 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/cases.testLocalFieldmask.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/cases.testLocalFieldmask.go @@ -14,7 +14,9 @@ import ( var _ = basictl.NatWrite type CasesTestLocalFieldmask struct { + // tlgen:tl1mask:"0" F1 uint32 + // tlgen:tl1mask:"1" F2 uint32 // Optional, use SetF2 // F3 bit // Optional, use SetF3 // F4 bit // Optional, use SetF4 diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/cases.testOutFieldMaskContainer.go b/internal/tlcodegen/test/gen/casesTL2/internal/cases.testOutFieldMaskContainer.go index 8db169a69..dd0c85b54 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/cases.testOutFieldMaskContainer.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/cases.testOutFieldMaskContainer.go @@ -14,6 +14,7 @@ import ( var _ = basictl.NatWrite type CasesTestOutFieldMaskContainer struct { + // tlgen:tl1mask:"0,3" F uint32 Fs uint32 Inner CasesTestOutFieldMask diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/cases.testRecursiveFieldMask.go b/internal/tlcodegen/test/gen/casesTL2/internal/cases.testRecursiveFieldMask.go index ada230ed8..6a8ef81a2 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/cases.testRecursiveFieldMask.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/cases.testRecursiveFieldMask.go @@ -15,8 +15,11 @@ var _ = basictl.NatWrite // BLOCK: TEST FIELD MASKS type CasesTestRecursiveFieldMask struct { + // tlgen:tl1mask:"0" F0 uint32 + // tlgen:tl1mask:"1" F1 uint32 // Optional, use SetF1 + // tlgen:tl1mask:"2" F2 uint32 // Optional, use SetF2 // T1 bit // Optional, use SetT1 // T2 bit // Optional, use SetT2 diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep1.go b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep1.go index 80beabef9..30a42f125 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep1.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep1.go @@ -13,6 +13,7 @@ import ( var _ = basictl.NatWrite +// tlgen:tl1name:"" type CasesTL2TestFunctionNoDep1 struct { X int32 } diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep2.go b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep2.go index e653a9b24..654c1d0df 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep2.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep2.go @@ -13,6 +13,7 @@ import ( var _ = basictl.NatWrite +// tlgen:tl1name:"" type CasesTL2TestFunctionNoDep2 struct { X int32 } diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep3.go b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep3.go index 5443455af..83a2a02c7 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep3.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep3.go @@ -13,6 +13,7 @@ import ( var _ = basictl.NatWrite +// tlgen:tl1name:"" type CasesTL2TestFunctionNoDep3 struct { X int32 } diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep4.go b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep4.go index 6be02d094..a0e4a1f79 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep4.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep4.go @@ -13,6 +13,7 @@ import ( var _ = basictl.NatWrite +// tlgen:tl1name:"" type CasesTL2TestFunctionNoDep4 struct { X int32 } diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep5.go b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep5.go index a54184b37..cb216b366 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep5.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep5.go @@ -13,6 +13,7 @@ import ( var _ = basictl.NatWrite +// tlgen:tl1name:"" type CasesTL2TestFunctionNoDep5 struct { X int32 } diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep6.go b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep6.go index 5361a486b..f79b1dadf 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep6.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep6.go @@ -13,6 +13,7 @@ import ( var _ = basictl.NatWrite +// tlgen:tl1name:"" type CasesTL2TestFunctionNoDep6 struct { X int32 } diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep7.go b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep7.go index 88124ca86..caebd670b 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep7.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionNoDep7.go @@ -13,6 +13,7 @@ import ( var _ = basictl.NatWrite +// tlgen:tl1name:"" type CasesTL2TestFunctionNoDep7 struct { X int32 } diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionWithDep1.go b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionWithDep1.go index edeee85a6..ea6907030 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionWithDep1.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionWithDep1.go @@ -13,6 +13,7 @@ import ( var _ = basictl.NatWrite +// tlgen:tl1name:"" type CasesTL2TestFunctionWithDep1 struct { N uint32 } diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionWithDep2.go b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionWithDep2.go index 8f6dffb50..ffc42ac32 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionWithDep2.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testFunctionWithDep2.go @@ -13,6 +13,7 @@ import ( var _ = basictl.NatWrite +// tlgen:tl1name:"" type CasesTL2TestFunctionWithDep2 struct { N uint32 } diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testObject.go b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testObject.go index c41babdf9..5ec2167fe 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testObject.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testObject.go @@ -14,6 +14,7 @@ import ( var _ = basictl.NatWrite type CasesTL2TestObject struct { + // tlgen:tl1mask:"0,1,14" N uint32 Ns uint32 // F1 bit // Optional, use SetF1 diff --git a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testParamsGeneration.go b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testParamsGeneration.go index 0d2394e4a..50b3eda2b 100644 --- a/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testParamsGeneration.go +++ b/internal/tlcodegen/test/gen/casesTL2/internal/casesTL2.testParamsGeneration.go @@ -14,6 +14,7 @@ import ( var _ = basictl.NatWrite type CasesTL2TestParamsGeneration struct { + // tlgen:tl1mask:"0,1" N1 uint32 N2 uint32 X1 CasesTL2TestObjectWithMuiltiParams diff --git a/internal/tlcodegen/test/gen/casesTL2/meta/meta.go b/internal/tlcodegen/test/gen/casesTL2/meta/meta.go index 4e4667acc..25fef572e 100644 --- a/internal/tlcodegen/test/gen/casesTL2/meta/meta.go +++ b/internal/tlcodegen/test/gen/casesTL2/meta/meta.go @@ -95,23 +95,23 @@ func init() { metainternal.FillObject( &metainternal.TLItemImpl{Name: "casesTL2.testFixedParam", HaTL2: true}) metainternal.FillFunction( - &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep1", Tag: 0x1b8b9feb, HaTL2: true}) + &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep1", Tag: 0x1b8b9feb, HaTL2: true, Annotations: 0x8}) metainternal.FillFunction( - &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep2", Tag: 0x0a2c0bf9, HaTL2: true}) + &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep2", Tag: 0x0a2c0bf9, HaTL2: true, Annotations: 0x8}) metainternal.FillFunction( - &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep3", Tag: 0xf020849b, HaTL2: true}) + &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep3", Tag: 0xf020849b, HaTL2: true, Annotations: 0x8}) metainternal.FillFunction( - &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep4", Tag: 0x5a933a50, HaTL2: true}) + &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep4", Tag: 0x5a933a50, HaTL2: true, Annotations: 0x8}) metainternal.FillFunction( - &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep5", Tag: 0x2b47b925, HaTL2: true, ResultTypeContainsUnionTypes: true}) + &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep5", Tag: 0x2b47b925, HaTL2: true, Annotations: 0x8, ResultTypeContainsUnionTypes: true}) metainternal.FillFunction( - &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep6", Tag: 0x9a316c2e, HaTL2: true}) + &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep6", Tag: 0x9a316c2e, HaTL2: true, Annotations: 0x8}) metainternal.FillFunction( - &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep7", Tag: 0x08824518, HaTL2: true}) + &metainternal.TLItemImpl{Name: "casesTL2.testFunctionNoDep7", Tag: 0x08824518, HaTL2: true, Annotations: 0x8}) metainternal.FillFunction( - &metainternal.TLItemImpl{Name: "casesTL2.testFunctionWithDep1", Tag: 0xb6c63b07, HaTL2: true}) + &metainternal.TLItemImpl{Name: "casesTL2.testFunctionWithDep1", Tag: 0xb6c63b07, HaTL2: true, Annotations: 0x8}) metainternal.FillFunction( - &metainternal.TLItemImpl{Name: "casesTL2.testFunctionWithDep2", Tag: 0x9d44a2fd, HaTL2: true}) + &metainternal.TLItemImpl{Name: "casesTL2.testFunctionWithDep2", Tag: 0x9d44a2fd, HaTL2: true, Annotations: 0x8}) metainternal.FillObject( &metainternal.TLItemImpl{Name: "casesTL2.testObject", HaTL2: true}) metainternal.FillObject( diff --git a/internal/tlcodegen/test/gen/casesTL2/tlcasesTL2/tlcasesTL2.go b/internal/tlcodegen/test/gen/casesTL2/tlcasesTL2/tlcasesTL2.go index a057aac78..83121b879 100644 --- a/internal/tlcodegen/test/gen/casesTL2/tlcasesTL2/tlcasesTL2.go +++ b/internal/tlcodegen/test/gen/casesTL2/tlcasesTL2/tlcasesTL2.go @@ -48,9 +48,11 @@ type Client struct { Timeout time.Duration // set to extra.CustomTimeoutMs, if not already set } +// tlgen:tl1name:"" func (c *Client) TestFunctionNoDep1(ctx context.Context, args TestFunctionNoDep1, extra *rpc.InvokeReqExtra, ret *int32) (err error) { req := c.Client.GetRequest() req.ActorID = c.ActorID + req.ReadOnly = true req.FunctionName = "casesTL2.testFunctionNoDep1" if extra != nil { req.Extra = extra.RequestExtra @@ -78,9 +80,11 @@ func (c *Client) TestFunctionNoDep1(ctx context.Context, args TestFunctionNoDep1 return nil } +// tlgen:tl1name:"" func (c *Client) TestFunctionNoDep2(ctx context.Context, args TestFunctionNoDep2, extra *rpc.InvokeReqExtra, ret *TestFunctionNoDep2__Result) (err error) { req := c.Client.GetRequest() req.ActorID = c.ActorID + req.ReadOnly = true req.FunctionName = "casesTL2.testFunctionNoDep2" if extra != nil { req.Extra = extra.RequestExtra @@ -108,9 +112,11 @@ func (c *Client) TestFunctionNoDep2(ctx context.Context, args TestFunctionNoDep2 return nil } +// tlgen:tl1name:"" func (c *Client) TestFunctionNoDep3(ctx context.Context, args TestFunctionNoDep3, extra *rpc.InvokeReqExtra, ret *[]int32) (err error) { req := c.Client.GetRequest() req.ActorID = c.ActorID + req.ReadOnly = true req.FunctionName = "casesTL2.testFunctionNoDep3" if extra != nil { req.Extra = extra.RequestExtra @@ -138,9 +144,11 @@ func (c *Client) TestFunctionNoDep3(ctx context.Context, args TestFunctionNoDep3 return nil } +// tlgen:tl1name:"" func (c *Client) TestFunctionNoDep4(ctx context.Context, args TestFunctionNoDep4, extra *rpc.InvokeReqExtra, ret *bool) (err error) { req := c.Client.GetRequest() req.ActorID = c.ActorID + req.ReadOnly = true req.FunctionName = "casesTL2.testFunctionNoDep4" if extra != nil { req.Extra = extra.RequestExtra @@ -168,9 +176,11 @@ func (c *Client) TestFunctionNoDep4(ctx context.Context, args TestFunctionNoDep4 return nil } +// tlgen:tl1name:"" func (c *Client) TestFunctionNoDep5(ctx context.Context, args TestFunctionNoDep5, extra *rpc.InvokeReqExtra, ret *TestObject) (err error) { req := c.Client.GetRequest() req.ActorID = c.ActorID + req.ReadOnly = true req.FunctionName = "casesTL2.testFunctionNoDep5" if extra != nil { req.Extra = extra.RequestExtra @@ -198,9 +208,11 @@ func (c *Client) TestFunctionNoDep5(ctx context.Context, args TestFunctionNoDep5 return nil } +// tlgen:tl1name:"" func (c *Client) TestFunctionNoDep6(ctx context.Context, args TestFunctionNoDep6, extra *rpc.InvokeReqExtra, ret *TestArrayFixedBool) (err error) { req := c.Client.GetRequest() req.ActorID = c.ActorID + req.ReadOnly = true req.FunctionName = "casesTL2.testFunctionNoDep6" if extra != nil { req.Extra = extra.RequestExtra @@ -228,9 +240,11 @@ func (c *Client) TestFunctionNoDep6(ctx context.Context, args TestFunctionNoDep6 return nil } +// tlgen:tl1name:"" func (c *Client) TestFunctionNoDep7(ctx context.Context, args TestFunctionNoDep7, extra *rpc.InvokeReqExtra, ret *TestFunctionNoDep7__Result) (err error) { req := c.Client.GetRequest() req.ActorID = c.ActorID + req.ReadOnly = true req.FunctionName = "casesTL2.testFunctionNoDep7" if extra != nil { req.Extra = extra.RequestExtra @@ -258,9 +272,11 @@ func (c *Client) TestFunctionNoDep7(ctx context.Context, args TestFunctionNoDep7 return nil } +// tlgen:tl1name:"" func (c *Client) TestFunctionWithDep1(ctx context.Context, args TestFunctionWithDep1, extra *rpc.InvokeReqExtra, ret *[]int32) (err error) { req := c.Client.GetRequest() req.ActorID = c.ActorID + req.ReadOnly = true req.FunctionName = "casesTL2.testFunctionWithDep1" if extra != nil { req.Extra = extra.RequestExtra @@ -288,9 +304,11 @@ func (c *Client) TestFunctionWithDep1(ctx context.Context, args TestFunctionWith return nil } +// tlgen:tl1name:"" func (c *Client) TestFunctionWithDep2(ctx context.Context, args TestFunctionWithDep2, extra *rpc.InvokeReqExtra, ret *TestFunctionWithDep2__Result) (err error) { req := c.Client.GetRequest() req.ActorID = c.ActorID + req.ReadOnly = true req.FunctionName = "casesTL2.testFunctionWithDep2" if extra != nil { req.Extra = extra.RequestExtra @@ -319,14 +337,23 @@ func (c *Client) TestFunctionWithDep2(ctx context.Context, args TestFunctionWith } type Handler struct { - TestFunctionNoDep1 func(ctx context.Context, args TestFunctionNoDep1) (int32, error) // casesTL2.testFunctionNoDep1 - TestFunctionNoDep2 func(ctx context.Context, args TestFunctionNoDep2) (TestFunctionNoDep2__Result, error) // casesTL2.testFunctionNoDep2 - TestFunctionNoDep3 func(ctx context.Context, args TestFunctionNoDep3) ([]int32, error) // casesTL2.testFunctionNoDep3 - TestFunctionNoDep4 func(ctx context.Context, args TestFunctionNoDep4) (bool, error) // casesTL2.testFunctionNoDep4 - TestFunctionNoDep5 func(ctx context.Context, args TestFunctionNoDep5) (TestObject, error) // casesTL2.testFunctionNoDep5 - TestFunctionNoDep6 func(ctx context.Context, args TestFunctionNoDep6) (TestArrayFixedBool, error) // casesTL2.testFunctionNoDep6 - TestFunctionNoDep7 func(ctx context.Context, args TestFunctionNoDep7) (TestFunctionNoDep7__Result, error) // casesTL2.testFunctionNoDep7 - TestFunctionWithDep1 func(ctx context.Context, args TestFunctionWithDep1) ([]int32, error) // casesTL2.testFunctionWithDep1 + // tlgen:tl1name:"" + TestFunctionNoDep1 func(ctx context.Context, args TestFunctionNoDep1) (int32, error) // casesTL2.testFunctionNoDep1 + // tlgen:tl1name:"" + TestFunctionNoDep2 func(ctx context.Context, args TestFunctionNoDep2) (TestFunctionNoDep2__Result, error) // casesTL2.testFunctionNoDep2 + // tlgen:tl1name:"" + TestFunctionNoDep3 func(ctx context.Context, args TestFunctionNoDep3) ([]int32, error) // casesTL2.testFunctionNoDep3 + // tlgen:tl1name:"" + TestFunctionNoDep4 func(ctx context.Context, args TestFunctionNoDep4) (bool, error) // casesTL2.testFunctionNoDep4 + // tlgen:tl1name:"" + TestFunctionNoDep5 func(ctx context.Context, args TestFunctionNoDep5) (TestObject, error) // casesTL2.testFunctionNoDep5 + // tlgen:tl1name:"" + TestFunctionNoDep6 func(ctx context.Context, args TestFunctionNoDep6) (TestArrayFixedBool, error) // casesTL2.testFunctionNoDep6 + // tlgen:tl1name:"" + TestFunctionNoDep7 func(ctx context.Context, args TestFunctionNoDep7) (TestFunctionNoDep7__Result, error) // casesTL2.testFunctionNoDep7 + // tlgen:tl1name:"" + TestFunctionWithDep1 func(ctx context.Context, args TestFunctionWithDep1) ([]int32, error) // casesTL2.testFunctionWithDep1 + // tlgen:tl1name:"" TestFunctionWithDep2 func(ctx context.Context, args TestFunctionWithDep2) (TestFunctionWithDep2__Result, error) // casesTL2.testFunctionWithDep2 } diff --git a/internal/tlcodegen/test/tls/cases.tl2 b/internal/tlcodegen/test/tls/cases.tl2 index 2cae06587..d369948dc 100644 --- a/internal/tlcodegen/test/tls/cases.tl2 +++ b/internal/tlcodegen/test/tls/cases.tl2 @@ -16,9 +16,15 @@ Maybe = pair = x:X y:Y ; // BLOCK: TEST RECURSIVE TYPES -cases.myCycle1 = fields_mask:uint32 a?:cases.myCycle2 ; -cases.myCycle2 = fields_mask:uint32 a?:cases.myCycle3 ; -cases.myCycle3 = fields_mask:uint32 a?:cases.myCycle1 ; +cases.myCycle1 = + // tlgen:tl1mask:"0" + fields_mask:uint32 a?:cases.myCycle2 ; +cases.myCycle2 = + // tlgen:tl1mask:"0" + fields_mask:uint32 a?:cases.myCycle3 ; +cases.myCycle3 = + // tlgen:tl1mask:"0" + fields_mask:uint32 a?:cases.myCycle1 ; // BLOCK: TEST BRACKETS (arrays, vectors, dicitinaries etc.) cases.testArray = n:uint32 arr:[]int32 ; @@ -65,14 +71,30 @@ cases.TestEnum = cases.testEnumContainer = value:cases.TestEnum ; // BLOCK: TEST FIELD MASKS -cases.testRecursiveFieldMask = f0:uint32 f1?:uint32 f2?:uint32 t1:bit t2:bit t3:bit ; -cases.testLocalFieldmask = f1:uint32 f2?:uint32 f3:bit f4:bit ; +cases.testRecursiveFieldMask = + // tlgen:tl1mask:"0" + f0:uint32 + // tlgen:tl1mask:"1" + f1?:uint32 + // tlgen:tl1mask:"2" + f2?:uint32 t1:bit t2:bit t3:bit ; +cases.testLocalFieldmask = + // tlgen:tl1mask:"0" + f1:uint32 + // tlgen:tl1mask:"1" + f2?:uint32 f3:bit f4:bit ; cases.testOutFieldMask = f1?:uint32 f2:bit f3:[]int32 ; -cases.testOutFieldMaskContainer = f:uint32 fs:uint32 inner:cases.testOutFieldMask ; -cases.testBeforeReadBitValidation = n:uint32 ns:uint32 a?:[]int32 b?:[]int32 ; - -cases.testAllPossibleFieldConfigs = local:uint32 locals:uint32 +cases.testOutFieldMaskContainer = + // tlgen:tl1mask:"0,3" + f:uint32 fs:uint32 inner:cases.testOutFieldMask ; +cases.testBeforeReadBitValidation = + // tlgen:tl1mask:"0,1" + n:uint32 ns:uint32 a?:[]int32 b?:[]int32 ; + +cases.testAllPossibleFieldConfigs = + // tlgen:tl1mask:"0,1,2,3" + local:uint32 locals:uint32 f00:int32 // no fieldmask, no nat dependencies in type f01:true // no fieldmask, true type f02:[]int32 // no fieldmask, have some local nat dependencies in type @@ -87,7 +109,9 @@ cases.testAllPossibleFieldConfigs = local:uint32 locals:uint32 f23?:[]int32 // outer fieldmask, have only external nat dependencies in type ; -cases.testAllPossibleFieldConfigsContainer = outer:uint32 outers:uint32 +cases.testAllPossibleFieldConfigsContainer = + // tlgen:tl1mask:"0,1,2,3" + outer:uint32 outers:uint32 value:cases.testAllPossibleFieldConfigs ; @@ -126,7 +150,9 @@ cases_bytes.testEnumContainer = value:cases.TestEnum ; // BLOCK: BENCHMARKS benchmarks.vruhash = low:int64 high:int64 ; -benchmarks.vruposition = fields_mask:uint32 +benchmarks.vruposition = + // tlgen:tl1mask:"0,1,3,5,14,15" + fields_mask:uint32 commit_bit:bit // we set this bit only if block with this bit set is committed, so we have no more than 1 such uncommitted block. meta_block:bit // this block contains meta data of VR protocol split_payload:bit // this position splits payload. If this set, meta_block and commit_bit are both not set @@ -155,7 +181,9 @@ benchmarks.vrutoyPositions = next_positions:[]benchmarks.vruposition benchmarks.vrutoyTopLevelContainerWithDependency = n:uint32 value:benchmarks.vrutoyPositions ; -casesTL2.testObject = n:uint32 +casesTL2.testObject = + // tlgen:tl1mask:"0,1,14" + n:uint32 ns:uint32 f1:bit f2:bool @@ -182,7 +210,9 @@ casesTL2.testFixedParam = x:casesTL2.testObjectWithParam ; casesTL2.testObjectWithParam = x?:int32 y:[]int32 ; -casesTL2.testParamsGeneration = n1:uint32 +casesTL2.testParamsGeneration = + // tlgen:tl1mask:"0,1" + n1:uint32 n2:uint32 x1:casesTL2.testObjectWithMuiltiParams x2:casesTL2.testObjectWithMuiltiParams @@ -190,28 +220,37 @@ casesTL2.testParamsGeneration = n1:uint32 x4:casesTL2.testObjectWithMuiltiParams ; -casesTL2.testObjectWithMuiltiParams = f1?:[]int32 +casesTL2.testObjectWithMuiltiParams = f1?:[]int32 f2?:[]int32 ; -casesTL2.testFunctionNoDep1#1b8b9feb x:int32 +// tlgen:tl1name:"" +@read casesTL2.testFunctionNoDep1#1b8b9feb x:int32 => int32; -casesTL2.testFunctionNoDep2#0a2c0bf9 x:int32 +// tlgen:tl1name:"" +@read casesTL2.testFunctionNoDep2#0a2c0bf9 x:int32 => ; -casesTL2.testFunctionNoDep3#f020849b x:int32 +// tlgen:tl1name:"" +@read casesTL2.testFunctionNoDep3#f020849b x:int32 => []int32; -casesTL2.testFunctionNoDep4#5a933a50 x:int32 +// tlgen:tl1name:"" +@read casesTL2.testFunctionNoDep4#5a933a50 x:int32 => bool; -casesTL2.testFunctionNoDep5#2b47b925 x:int32 +// tlgen:tl1name:"" +@read casesTL2.testFunctionNoDep5#2b47b925 x:int32 => casesTL2.testObject; -casesTL2.testFunctionNoDep6#9a316c2e x:int32 +// tlgen:tl1name:"" +@read casesTL2.testFunctionNoDep6#9a316c2e x:int32 => casesTL2.testArrayFixedBool; -casesTL2.testFunctionNoDep7#08824518 x:int32 +// tlgen:tl1name:"" +@read casesTL2.testFunctionNoDep7#08824518 x:int32 => cases.testAllDicts; -casesTL2.testFunctionWithDep1#b6c63b07 n:uint32 +// tlgen:tl1name:"" +@read casesTL2.testFunctionWithDep1#b6c63b07 n:uint32 => []int32; -casesTL2.testFunctionWithDep2#9d44a2fd n:uint32 +// tlgen:tl1name:"" +@read casesTL2.testFunctionWithDep2#9d44a2fd n:uint32 => benchmarks.vrutoyPositions; -casesGo.testNames = write:int32 read:int32; +casesGo.testNames = write:int32 read:int32 ; \ No newline at end of file