1 /******************************************************************************
2 * Copyright (c) 2000-2016 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
9 * Adrien Kirjak – initial implementation
12 ** @purpose 1:15.8, ensure that symbols created during template expansion are checked against omit template restriction
13 ** @verdict pass reject
14 ***************************************************/
17 // Field reference on a left hand side of an assignment statement can lead to expansion of
18 // a matching symbol. If the values of the expanded symbol do not fullfil conditions set by
19 // template restrictions (after the assignment has been finished), the running test shall
20 // end with a dynamic error.
22 // The following requirements are tested:
23 // (15.6.2.a) When referencing a subfield within a structured field to which AnyValueOrNone
24 // or omit is assigned, at the left hand side of an assignment, the structured field is
25 // implicitly set to be present, it is expanded recursively up to and including the depth
26 // of the referenced subfield. During this expansion an AnyValue shall be assigned to mandatory
27 // subfields and AnyValueOrNone shall be assigned to optional subfields. After this expansion
28 // the value or matching mechanism at the right hand side of the assignment shall be assigned
29 // to the referenced subfield.
31 // (15.8) (omit) the template shall resolve to a value matching mechanism (i.e. the fields
32 // of it shall resolve to a specific value or omit, and the whole template may also resolve to
33 // omit). Such a template can be used to define a field of a record and set template and the
34 // latter one could still be used in a send statement.
36 module NegSem_1508_TemplateRestrictions_027 {
38 type component GeneralComp { }
45 testcase TC_NegSem_1508_TemplateRestrictions_027() runs on GeneralComp {
46 var omit R v_test := omit;
47 v_test.field1 := 0; // As the result of expansion, v_test value is { field1 := ?, field2 := ? }
48 // After the field assignment it changes to { field1 := 0, field2 := ? }
49 // This value (field2 in particular) violates omit restriction an shall cause an error
51 // if we get here, something must be wrong as the previous assignment shall cause an error
56 execute(TC_NegSem_1508_TemplateRestrictions_027());