osmo-ttcn3-hacks/a9d8c3ee3cd5babc3a141061beb...

92 lines
5.1 KiB
Plaintext

{
"comments": [
{
"unresolved": true,
"key": {
"uuid": "b88cc276_adff2300",
"filename": "library/L1CTL_Types.ttcn",
"patchSetId": 1
},
"lineNbr": 859,
"author": {
"id": 1000074
},
"writtenOn": "2024-03-13T11:59:57Z",
"side": 1,
"message": "template (present)",
"revId": "a9d8c3ee3cd5babc3a141061beb3182a6aecef14",
"serverId": "035e6965-6537-41bd-912c-053f3cf69326"
},
{
"unresolved": true,
"key": {
"uuid": "2ff44d28_fab6d82e",
"filename": "library/L1CTL_Types.ttcn",
"patchSetId": 1
},
"lineNbr": 859,
"author": {
"id": 1000010
},
"writtenOn": "2024-03-13T12:21:54Z",
"side": 1,
"message": "Can you explain the motivation behind marking the whole template as `(present)`? I do understand and encourage doing this for template fields, I also understand the reason for declaring send templates as `(value)`, but I cannot find any explanation what would `(present)` yield for a receive template.",
"parentUuid": "b88cc276_adff2300",
"revId": "a9d8c3ee3cd5babc3a141061beb3182a6aecef14",
"serverId": "035e6965-6537-41bd-912c-053f3cf69326"
},
{
"unresolved": true,
"key": {
"uuid": "a1dd9a99_f044f1d9",
"filename": "library/L1CTL_Types.ttcn",
"patchSetId": 1
},
"lineNbr": 859,
"author": {
"id": 1000074
},
"writtenOn": "2024-03-13T13:08:33Z",
"side": 1,
"message": "Because:\n1- It really is a \"template (present)\", it cannot be omit.\n2- Then if you want to pass it as a param to another template which expects as param \"template (present)\", it won\u0027t match the expectancies. This probably generates warnings.",
"parentUuid": "2ff44d28_fab6d82e",
"revId": "a9d8c3ee3cd5babc3a141061beb3182a6aecef14",
"serverId": "035e6965-6537-41bd-912c-053f3cf69326"
},
{
"unresolved": true,
"key": {
"uuid": "5e50021d_4ae3bc24",
"filename": "library/L1CTL_Types.ttcn",
"patchSetId": 1
},
"lineNbr": 859,
"author": {
"id": 1000010
},
"writtenOn": "2024-03-13T15:06:24Z",
"side": 1,
"message": "\u003e 1- It really is a \"template (present)\", it cannot be omit.\n\nYes, it\u0027s obvious that a complete template definition cannot be `omit` unless it\u0027s a direct and implicit assignment of `omit` (`template Foo bar :\u003d omit;`), and unless it\u0027s generated and returned by a function (`template Foo bar :\u003d f_gen_tr_Foo(...);`). So I would say it\u0027s redundant to say that it\u0027s `(present)` in this specific case.\n\n\u003e 2- Then if you want to pass it as a param to another template which expects as param \"template (present)\", it won\u0027t match the expectancies. This probably generates warnings.\n\nI don\u0027t think this is the case, at least it\u0027s not with TITAN.\nThe following code compiles without any warnings, and the testcase is passing:\n\n```\ndiff --git a/selftest/Selftest.ttcn b/selftest/Selftest.ttcn\nindex 3d749253..5ee8a544 100644\n--- a/selftest/Selftest.ttcn\n+++ b/selftest/Selftest.ttcn\n@@ -94,6 +94,39 @@ testcase TC_ipa_fragment() runs on IPA_selftest_CT {\n setverdict(pass);\n }\n \n+private type record FooBar {\n+ integer foo,\n+ integer bar\n+};\n+\n+private type record FooBarZoo {\n+ FooBar foo_bar,\n+ integer zoo\n+};\n+\n+template FooBar tr_FooBar(template (present) integer foo,\n+ template (present) integer bar) :\u003d {\n+ foo :\u003d foo,\n+ bar :\u003d bar\n+}\n+\n+template FooBarZoo tr_FooBarZoo(template (present) FooBar foo_bar,\n+ template (present) integer zoo) :\u003d {\n+ foo_bar :\u003d foo_bar,\n+ zoo :\u003d zoo\n+}\n+\n+private type component dummy_CT { };\n+\n+testcase TC_foo_bar_zoo() runs on dummy_CT {\n+ var FooBarZoo fbz :\u003d { { 1, 2 }, 42 };\n+\n+ if (match(fbz, tr_FooBarZoo(tr_FooBar(?, ?), 42))) {\n+ setverdict(pass);\n+ } else {\n+ setverdict(fail);\n+ }\n+}\n \n control {\n execute( TC_ipa_fragment() );\n\n```\n\nNote that I am passing `tr_FooBar(?, ?)`, which is defined without the `(present)` restriction, to `tr_FooBarZoo`, which does expect the first template parameter to be `(present)`.\n\nAll in all, I don\u0027t think we should be forcing this during code review.",
"parentUuid": "a1dd9a99_f044f1d9",
"revId": "a9d8c3ee3cd5babc3a141061beb3182a6aecef14",
"serverId": "035e6965-6537-41bd-912c-053f3cf69326"
},
{
"unresolved": true,
"key": {
"uuid": "61309f88_d2d23fb2",
"filename": "library/L1CTL_Types.ttcn",
"patchSetId": 1
},
"lineNbr": 888,
"author": {
"id": 1000074
},
"writtenOn": "2024-03-13T11:59:57Z",
"side": 1,
"message": "template (present)",
"revId": "a9d8c3ee3cd5babc3a141061beb3182a6aecef14",
"serverId": "035e6965-6537-41bd-912c-053f3cf69326"
}
]
}