Skip to content
Snippets Groups Projects

Advanced matching semantic check improvements and tests #413 #414 #415

Merged Adam Knapp requested to merge optional into master
12 files
+ 258
55
Compare changes
  • Side-by-side
  • Inline
Files
12
/******************************************************************************
* Copyright (c) 2000-2021 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
*
* Contributors:
* Baranyi, Botond
*
******************************************************************************/
module TempDynamic_SE { //^In TTCN-3 module//
template integer t1 := @dynamic { return value mod 2 == 0; }
function f_not_a_template() return integer { //^In function definition//
return value mod 2; //^In return statement// //^In the left operand of operation//2 //Reference to value being matched is only allowed inside a dynamic template's statement block//
}
template integer t2 := @dynamic { } //^In template definition// //The dynamic template's statement block does not have a return statement//
template integer t3 := @dynamic { return; } //^In template definition// //^In return statement// //Missing return value. The dynamic template's statement block should return a boolean value//
template float t4 := @dynamic { return 1; } //^In template definition// //^In return statement// //boolean value was expected//
template integer t5 := @dynamic { return ?; } //^In template definition// //^In return statement// //A specific value without matching symbols was expected as return value//
template integer t6 := @dynamic { //^In template definition// //Control might leave the dynamic template's statement block without reaching a return statement//
if (value > 3) { return true; }
}
type component CT {
var integer v_cv;
}
const integer cg_c := 3;
function f_f() runs on CT {
var template integer vt := @dynamic {
if (value > cg_c) { return true; }
v_cv := value;
return false;
}
}
template (omit) integer t7 := @dynamic { return value mod 2 == 0; } //^In template definition// //^While checking template restriction// //Restriction on template definition does not allow usage of dynamic match//
template (value) integer t8 := @dynamic { return value mod 2 == 0; } //^In template definition// //^While checking template restriction// //Restriction on template definition does not allow usage of dynamic match//
template (present) integer t9 := @dynamic { return value mod 2 == 0; }
}
Loading