Attention is currently required from: pespin.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36254?usp=email )
Change subject: library: add templates for L1CTL_{DATA,TRAFFIC}_CONF ......................................................................
Patch Set 1:
(1 comment)
File library/L1CTL_Types.ttcn:
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36254/comment/5e50021d_4ae3b... PS1, Line 859: template L1ctlMessage
1- It really is a "template (present)", it cannot be omit.
Yes, it's obvious that a complete template definition cannot be `omit` unless it's a direct and implicit assignment of `omit` (`template Foo bar := omit;`), and unless it's generated and returned by a function (`template Foo bar := f_gen_tr_Foo(...);`). So I would say it's redundant to say that it's `(present)` in this specific case.
2- Then if you want to pass it as a param to another template which expects as param "template (present)", it won't match the expectancies. This probably generates warnings.
I don't think this is the case, at least it's not with TITAN. The following code compiles without any warnings, and the testcase is passing:
``` diff --git a/selftest/Selftest.ttcn b/selftest/Selftest.ttcn index 3d749253..5ee8a544 100644 --- a/selftest/Selftest.ttcn +++ b/selftest/Selftest.ttcn @@ -94,6 +94,39 @@ testcase TC_ipa_fragment() runs on IPA_selftest_CT { setverdict(pass); }
+private type record FooBar { + integer foo, + integer bar +}; + +private type record FooBarZoo { + FooBar foo_bar, + integer zoo +}; + +template FooBar tr_FooBar(template (present) integer foo, + template (present) integer bar) := { + foo := foo, + bar := bar +} + +template FooBarZoo tr_FooBarZoo(template (present) FooBar foo_bar, + template (present) integer zoo) := { + foo_bar := foo_bar, + zoo := zoo +} + +private type component dummy_CT { }; + +testcase TC_foo_bar_zoo() runs on dummy_CT { + var FooBarZoo fbz := { { 1, 2 }, 42 }; + + if (match(fbz, tr_FooBarZoo(tr_FooBar(?, ?), 42))) { + setverdict(pass); + } else { + setverdict(fail); + } +}
control { execute( TC_ipa_fragment() );
```
Note 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)`.
All in all, I don't think we should be forcing this during code review.