ETSI's Bug Tracker - Part 01: TTCN-3 Core Language
View Issue Details

ID | Project | Category | View Status | Date Submitted | Last Update
0007496 | Part 01: TTCN-3 Core Language | New Feature | public | 01-09-2016 09:58 | 30-12-2017 18:57

Reporter | Jacob Wieland - Spirent |
Assigned To | Gyorgy Rethy |
Priority | normal | Severity | minor | Reproducibility | have not tried
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version | v4.9.1 (published 2017-05) |
Target Version | v4.10.1 (published 2018-05) | Fixed in Version | v4.10.1 (published 2018-05) |
Clause Reference(s) | 5.4.1, 16.1
Source (company - Author) | Spirent - Jacob Wieland

Summary | 0007496: Formal parameters and return values should also be declarable as arrays.

Description

At the moment, it is not possible to pass an array variable as an actual parameter without having to additionally define the corresponding array type (and use that as the formal parameter type).
This makes refactoring of code when such array variables are involved and need to be passed as parameter either impossible or forces the refactoring process to add such artificial array types (if they don't exist already).
Example:
function f() {
var ptcType ptcs[10];
var integer i;
for (i := 0; i < 10; i := i + 1) { // <--------
ptcs[i] = ptcType.create; // <--------
} // <--------
for (i := 0; i < 10; i := i + 1) {
ptcs[i].start(ptcBehavior());
}
}
When trying to refactor the first for-loop, one would imagine a function like this:
function createPtcs(inout ptcType ptcs[10], inout integer i) {
for (i := 0; i < 10; i := i + 1) {
ptcs[i] = ptcType.create;
}
}
to preserve the same semantics.
But, because it is not possible to declare the first variable as an array, it is necessary to do it like this:
type ptcType ptcTypeArray[10];
function createPtcs(inout ptcTypeArray ptcs, inout integer i) {
for (i := 0; i < 10; i := i + 1) {
ptcs[i] = ptcType.create;
}
}
The same, of course, is also true if the array is to be passed as return value, but here, it is a bit more tricky because the syntax of the Type Expression after the return keyword can already include a [-] for referencing an element type of a record-of type. Fortunately, the syntax [-] can be clearly distinguished from [<length>], even though it is a bit subtle.

Steps To Reproduce |
Additional Information |
Tags | No tags attached.
Relationships |
Attached Files | CR7496-v1.docx (360,164) 25-07-2017 12:49 http://oldforge.etsi.org/mantis/file_download.php?file_id=3652&type=bug

Issue History
Date Modified | Username | Field | Change
01-09-2016 09:58 | Jacob Wieland - Spirent | New Issue |
14-11-2016 13:40 | Jens Grabowski | Assigned To | => Tomas Urban
14-11-2016 13:40 | Jens Grabowski | Status | new => assigned
17-11-2016 13:49 | Jens Grabowski | Note Added: 0014305 |
17-11-2016 13:49 | Jens Grabowski | Target Version | v4.9.1 (published 2017-05) => v4.10.1 (published 2018-05)
25-07-2017 12:49 | Tomas Urban | File Added: CR7496-v1.docx |
25-07-2017 12:49 | Tomas Urban | Note Added: 0014750 |
25-07-2017 12:49 | Tomas Urban | Assigned To | Tomas Urban => Jacob Wieland - Spirent
25-07-2017 12:49 | Tomas Urban | Status | assigned => confirmed
26-07-2017 09:40 | Jacob Wieland - Spirent | Note Added: 0014775 |
26-07-2017 09:40 | Jacob Wieland - Spirent | Status | confirmed => resolved
26-07-2017 09:40 | Jacob Wieland - Spirent | Fixed in Version | => v4.9.1 (published 2017-05)
26-07-2017 09:40 | Jacob Wieland - Spirent | Resolution | open => fixed
26-07-2017 09:40 | Jacob Wieland - Spirent | Assigned To | Jacob Wieland - Spirent => Gyorgy Rethy
30-12-2017 18:57 | Gyorgy Rethy | Note Added: 0014964 |
30-12-2017 18:57 | Gyorgy Rethy | Status | resolved => closed
30-12-2017 18:57 | Gyorgy Rethy | Product Version | => v4.9.1 (published 2017-05)
30-12-2017 18:57 | Gyorgy Rethy | Fixed in Version | v4.9.1 (published 2017-05) => v4.10.1 (published 2018-05)

Notes

(0014305)
Jens Grabowski
17-11-2016 13:49

Resolution postponed to 2017 version.

(0014750)
Tomas Urban
25-07-2017 12:49

Resolution uploaded. Please check.

(0014775)
Jacob Wieland - Spirent
26-07-2017 09:40

fine with me

(0014964)
Gyorgy Rethy
30-12-2017 18:57

Implemented in draft V4.9.2