Sync with 5.4.1
[deliverable/titan.core.git] / function_test / Semantic_Analyser / template / TempRes_SE.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2015 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 ******************************************************************************/
8 module TempRes_SE { //^In TTCN-3 module//
9
10 type record Rec {
11 integer i,
12 float f,
13 charstring cs,
14 octetstring os
15 }
16
17 template (present) Rec t_original(in template (present) integer pt_i) := { //^Referenced template parameter is here$//2
18 i := pt_i, //^warning: Inadequate restriction on the referenced template parameter//2
19 f := ?, //^Referenced template is here$//
20 cs := ?, //^Referenced template is here$//2
21 os := ? //^Referenced template is here$//2
22 }
23
24 template (present) Rec t_modified(in template (present) integer pt_i, in template (present) float pt_f) //^Referenced template parameter is here$//
25 modifies t_original := {
26 f := pt_f //^warning: Inadequate restriction on the referenced template parameter//
27 }
28
29 function f_rec_temp(in template (value) Rec pt_rec_temp) {
30 log(pt_rec_temp);
31 }
32
33 template float t_f := (-10.0..-1.0); //^Referenced template is here$//
34 template charstring t_cs := ("abc", "def") ifpresent; //^Referenced template is here$//
35
36 function f_float_temp() return template (value) float { //^In function definition//
37 return t_f; //^In return statement// //^error: Restriction on return template does not allow usage of value range match$//
38 }
39
40 control { //^In control part//
41 var template (present) charstring vt_cs := "a";
42
43 var template integer vt_i := 3; //^Referenced template variable is here$//
44
45 f_rec_temp(t_modified(3, f_float_temp())); //^In function instance// //^In actual parameter list of function// \
46 //^In parameter #1 for// //^error: Restriction on template formal parameter does not allow usage of any value$//2
47
48 f_rec_temp(t_original(vt_i)); //^In function instance// //^In actual parameter list of function// \
49 //^In parameter #1 for//2 //^In actual parameter list of template// \
50 //^warning: Inadequate restriction on the referenced template variable// \
51 //^error: Restriction on template formal parameter does not allow usage of any value$//3
52
53 vt_cs := t_cs; //^In variable assignment:$// //^error: Restriction on template does not allow usage of \`ifpresent\'$//
54 }
55
56 }
This page took 0.031994 seconds and 5 git commands to generate.