Update patch set 1

Patch Set 1:

(1 comment)

Patch-set: 1
Attention: {"person_ident":"Gerrit User 1000010 \u003c1000010@035e6965-6537-41bd-912c-053f3cf69326\u003e","operation":"REMOVE","reason":"\u003cGERRIT_ACCOUNT_1000010\u003e replied on the change"}
Attention: {"person_ident":"Gerrit User 1000074 \u003c1000074@035e6965-6537-41bd-912c-053f3cf69326\u003e","operation":"ADD","reason":"\u003cGERRIT_ACCOUNT_1000010\u003e replied on the change"}
This commit is contained in:
Gerrit User 1000010 2024-03-13 15:06:24 +00:00 committed by Gerrit Code Review
parent c6bbc2392f
commit 14f3b79002
1 changed files with 18 additions and 0 deletions

View File

@ -53,6 +53,24 @@
"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": {