/****************************************************************************** * 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 oop_SE { //^In TTCN-3 module// type component Comp { var integer cv_comp; const integer cc_comp := -1; timer c_timer; } type port Port message { inout integer } with { extension "internal" } type record Rec { integer num, charstring str } type record of integer RoI; type union Uni { integer i, float f } signature Sig(inout integer p); type integer SmallNumber (-100..100); type enumerated Enum { E1, E2, E3 }; const integer c := 3; template integer t := 4; type class C0 { } type class C1 extends Nonexistent { } //^In type definition// //^In superclass definition// //There is no local or imported definition with name `Nonexistent'// type class C2 extends c { } //^In type definition// //^In superclass definition// //`c' is not a reference to a type// type class C3 extends Rec { } //^In type definition// //^In superclass definition// //Class type expected instead of `@oop_SE.Rec'// type class C4 { //^In type definition// private var integer m_private_inherited; /*protected*/ var charstring m_protected_inherited; public var Rec m_public_inherited; //Class members cannot be public// private function f_private_inherited() {} /*protected*/ function f_protected_inherited() {} public function f_public_inherited() {} } type class C5 extends C4 { //^In type definition// private var boolean m_private_own; /*protected*/ var float m_protected_own; public var octetstring m_public_own; //Class members cannot be public// private function f_private_own() {} /*protected*/ function f_protected_own() {} public function f_public_own() {} public function f_member_access_inside() { //^In function definition// log(m_private_inherited); //^In log statement// //The member definition `m_private_inherited' in class type `C5' is not visible in this scope// log(m_protected_inherited); log(m_public_inherited); log(m_private_own); log(m_protected_own); log(m_public_own); log(m_nonexistent); //^In log statement// //There is no local or imported definition with name `m_nonexistent'// f_private_inherited(); //^In function or altstep instance// //The method definition `f_private_inherited' in class type `C5' is not visible in this scope// f_protected_inherited(); f_public_inherited(); f_private_own(); f_protected_own(); f_public_own(); f_nonexistent(); //^In function or altstep instance// //There is no local or imported definition with name `f_nonexistent'// } } function f_member_access_outside() { //^In function definition// var C5 obj := C5.create(1, "a", { 2, "b" }, true, 0.1, '12'O); log(obj.m_private_inherited); //^In log statement// //The member definition `m_private_inherited' in class type `C5' is not visible in this scope// log(obj.m_protected_inherited); //^In log statement// //The member definition `m_protected_inherited' in class type `C5' is not visible in this scope// log(obj.m_public_inherited); log(obj.m_private_own); //^In log statement// //The member definition `m_private_own' in class type `C5' is not visible in this scope// log(obj.m_protected_own); //^In log statement// //The member definition `m_protected_own' in class type `C5' is not visible in this scope// log(obj.m_public_own); log(obj.m_nonexistent); //^In log statement// //Reference to non-existent member `m_nonexistent' in class type `@oop_SE.C5'// obj.f_private_inherited(); //^In function instance// //The method definition `f_private_inherited' in class type `C5' is not visible in this scope// obj.f_protected_inherited(); //^In function instance// //The method definition `f_protected_inherited' in class type `C5' is not visible in this scope// obj.f_public_inherited(); obj.f_private_own(); //^In function instance// //The method definition `f_private_own' in class type `C5' is not visible in this scope// obj.f_protected_own(); //^In function instance// //The method definition `f_protected_own' in class type `C5' is not visible in this scope// obj.f_public_own(); obj.f_nonexistent(); //^In function instance// //Reference to non-existent method `f_nonexistent' in class type `@oop_SE.C5'// } type class C6 { //^In type definition// public function f_member_access_other_class() { //^In function definition// var C5 obj := C5.create(1, "a", { 2, "b" }, true, 0.1, '12'O); log(obj.m_private_inherited); //^In log statement// //The member definition `m_private_inherited' in class type `C5' is not visible in this scope// log(obj.m_protected_inherited); //^In log statement// //The member definition `m_protected_inherited' in class type `C5' is not visible in this scope// log(obj.m_public_inherited); log(obj.m_private_own); //^In log statement// //The member definition `m_private_own' in class type `C5' is not visible in this scope// log(obj.m_protected_own); //^In log statement// //The member definition `m_protected_own' in class type `C5' is not visible in this scope// log(obj.m_public_own); log(obj.m_nonexistent); //^In log statement// //Reference to non-existent member `m_nonexistent' in class type `@oop_SE.C5'// obj.f_private_inherited(); //^In function instance// //The method definition `f_private_inherited' in class type `C5' is not visible in this scope// obj.f_protected_inherited(); //^In function instance// //The method definition `f_protected_inherited' in class type `C5' is not visible in this scope// obj.f_public_inherited(); obj.f_private_own(); //^In function instance// //The method definition `f_private_own' in class type `C5' is not visible in this scope// obj.f_protected_own(); //^In function instance// //The method definition `f_protected_own' in class type `C5' is not visible in this scope// obj.f_public_own(); obj.f_nonexistent(); //^In function instance// //Reference to non-existent method `f_nonexistent' in class type `@oop_SE.C5'// } } type class C7 extends C9 { } //^In type definition// //^In superclass definition// type class C8 extends C7 { } //^In type definition// //While checking embedded recursions\: Circular reference\: `@oop_SE.C8' -> `@oop_SE.C8.' -> `@oop_SE.C7' -> `@oop_SE.C7.' -> `@oop_SE.C9' -> `@oop_SE.C9.' -> `@oop_SE.C8'// type class C9 extends C8 { } //^In type definition// //^In superclass definition// external const C0 ec_c0; //^In external constant definition// //External constant cannot be defined for class type `@oop_SE.C0'// external const object ec_obj; //^In external constant definition// //External constant cannot be defined for class type `object'// modulepar C0 mp_c0; //^In module parameter definition// //Type of module parameter cannot be or embed class type `@oop_SE.C0'// modulepar object mp_obj; //^In module parameter definition// //Type of module parameter cannot be or embed class type `object'// modulepar template C0 mpt_c0; //^In template module parameter definition// //Type of template module parameter cannot be class type `@oop_SE.C0'// modulepar template object mpt_obj; //^In template module parameter definition// //Type of template module parameter cannot be class type `object'// function f_defs() { //^In function definition// const C0 c_c0 := null; //^In constant definition// //Constant cannot be defined for class type `@oop_SE.C0'// const object c_obj := null; //^In constant definition// //Constant cannot be defined for class type `object'// var C0 v_c0; var object v_obj; template C0 t_c0 := *; //^In template definition// //Template cannot be defined for class type `@oop_SE.C0'// template object t_obj := *; //^In template definition// //Template cannot be defined for class type `object'// var template C0 vt_c0; //^In template variable definition// //Template variable cannot be defined for class type `@oop_SE.C0'// var template object vt_obj; //^In template variable definition// //Template variable cannot be defined for class type `object'// } type record RecClass { //^In type definition// C0 x, //^In record field// //Class type `@oop_SE.C0' cannot be embedded into another type// object y //^In record field// //Class type `object' cannot be embedded into another type// } type set SetClass { //^In type definition// C0 x, //^In set field// //Class type `@oop_SE.C0' cannot be embedded into another type// object y //^In set field// //Class type `object' cannot be embedded into another type// } type record of C0 RecOfClass; //^In type definition// //^In embedded type of record of// //Class type `@oop_SE.C0' cannot be embedded into another type// type record of object RecOfObject; //^In type definition// //^In embedded type of record of// //Class type `object' cannot be embedded into another type// type set of C0 SetOfClass; //^In type definition// //^In embedded type of set of// //Class type `@oop_SE.C0' cannot be embedded into another type// type set of object SetOfObject; //^In type definition// //^In embedded type of set of// //Class type `object' cannot be embedded into another type// type union UniClass { //^In type definition// C0 x, //^In union field// //Class type `@oop_SE.C0' cannot be embedded into another type// object y //^In union field// //Class type `object' cannot be embedded into another type// } function f_embedded_types() { //^In function definition// var RecClass v_rec := { x := C0.create }; var SetClass v_set := { x := C0.create }; var RecOfClass v_recof := { C0.create }; var SetOfClass v_setof := { C0.create }; var UniClass v_uni := { x := C0.create }; var anytype v_any; //^In variable definition// //^In type definition// v_any.C0 := C0.create; } function f_type_compatibility() { //^In function definition// var C4 x1 := C4.create(1, "a", { 2, "b" }); var C5 y1 := C4.create(1, "a", { 2, "b" }); //^In variable definition// //Incompatible class types: operation `create' should refer to `@oop_SE.C5' instead of `@oop_SE.C4'// var C4 x2 := C5.create(1, "a", { 2, "b" }, true, 0.1, '12'O); var C5 y2 := C5.create(1, "a", { 2, "b" }, true, 0.1, '12'O); var C4 x3 := y1; var C5 y3 := x1; //^In variable definition// //Type mismatch: a value of type `@oop_SE.C5' was expected instead of `@oop_SE.C4'// x3 := y2; y3 := x2; //^In variable assignment// //Type mismatch: a value of type `@oop_SE.C5' was expected instead of `@oop_SE.C4'// log(x1.m_public_inherited); log(y1.m_public_inherited); log(x1.m_public_own); //^In log statement// //Reference to non-existent member `m_public_own' in class type `@oop_SE.C4'// log(y1.m_public_own); x1.f_public_inherited(); y1.f_public_inherited(); x1.f_public_own(); //^In function instance// //Reference to non-existent method `f_public_own' in class type `@oop_SE.C4'// y1.f_public_own(); } type component CT_RunsOn { var integer cv_runs_on; const integer cc_runs_on := 0; } type component CT_Mtc { var integer cv_mtc; const integer cc_mtc := 1; port Port pt; } type component CT_System { var integer cv_system; const integer cc_system := 2; port Port pt; } type component CT_RunsOn2 extends CT_RunsOn { var template integer cvt_runs_on := *; } type component CT_Mtc2 extends CT_Mtc { var template integer cvt_mtc := ?; } type component CT_System2 extends CT_System { var template integer cvt_system := omit; } type class C10 runs on CT_RunsOn mtc CT_Mtc system CT_System { //^In type definition// public function f_comp_visibility(in integer p1 := cc_runs_on, //^In function definition// //^In formal parameter list// in integer p2 := cc_mtc, in integer p3 := cc_system, in integer p4 := cc_comp) { //^In parameter// //^In default value// //There is no local or imported definition with name `cc_comp'// log(cv_runs_on); log(cv_mtc); log(cv_system); log(cv_comp); //^In log statement// //There is no local or imported definition with name `cv_comp'// } } type class C11 extends C10 { //^In type definition// public function f_inherited_comp_visibility(in integer p1 := cc_runs_on, //^In function definition// //^In formal parameter list// in integer p2 := cc_mtc, in integer p3 := cc_system, in integer p4 := cc_comp) { //^In parameter// //^In default value// //There is no local or imported definition with name `cc_comp'// log(cv_runs_on); log(cv_mtc); log(cv_system); log(cv_comp); //^In log statement// //There is no local or imported definition with name `cv_comp'// } } type class C12 extends C10 runs on CT_RunsOn mtc CT_Mtc system CT_System { } type class C13 extends C11 //^In type definition// runs on Comp //^In `runs on' clause// //The `runs on' component type of the subclass, `@oop_SE.Comp', is not compatible with the `runs on' component type of the superclass, `@oop_SE.CT_RunsOn'// mtc Comp //^In `mtc' clause// //The `mtc' component type of the subclass, `@oop_SE.Comp', is not compatible with the `mtc' component type of the superclass, `@oop_SE.CT_Mtc'// system Comp //^In `system' clause// //The `system' component type of the subclass, `@oop_SE.Comp', is not compatible with the `system' component type of the superclass, `@oop_SE.CT_System'// { } type class C14 extends C11 runs on CT_RunsOn2 mtc CT_Mtc2 system CT_System2 { } function f_good_comp_usage() runs on CT_RunsOn mtc CT_Mtc system CT_System { var C11 x := C11.create; } function f_bad_comp_usage() runs on Comp mtc Comp system Comp { //^In function definition// var C11 x := C11.create; //^In variable definition// //Runs on clause mismatch: A definition that runs on component type `@oop_SE.Comp' cannot create a value of class type `@oop_SE.C11', which runs on `@oop_SE.CT_RunsOn'// //Mtc clause mismatch: A definition that runs on component type `@oop_SE.Comp' cannot create a value of class type `@oop_SE.C11', which has `mtc' component type `@oop_SE.CT_Mtc'// //System clause mismatch: A definition that runs on component type `@oop_SE.Comp' cannot create a value of class type `@oop_SE.C11', which has `system' component type `@oop_SE.CT_System'// } function f_no_comp_usage() { //^In function definition// var C11 x := C11.create; //^In variable definition// //A definition without `runs on' clause cannot create a value of class type `@oop_SE.C11', which runs on component type `@oop_SE.CT_RunsOn'// } type class C15 { //^In type definition// var integer v; function f() { } function g() return boolean { return true; } function f_access_with_class_name() { //^In function definition// log(C5.v); //^In log statement// //Reference to a value, template, timer, port or class object was expected instead of type `@oop_SE.C5'// log(C5.g()); //^In log statement// //Reference to a value, template, timer, port or class object was expected instead of type `@oop_SE.C5'// C5.f(); //Reference to a function or altstep was expected instead of type `@oop_SE.C5', which cannot be invoked// C5.g(); //Reference to a function or altstep was expected instead of type `@oop_SE.C5', which cannot be invoked// if (C5.g()) { log(1); } //^In if statement// //Reference to a value was expected instead of type `@oop_SE.C5'// if (C5.v == 1) { log(2); } //^In if statement// //Reference to a value was expected instead of type `@oop_SE.C5'// var integer x1 := C5.v + 1; //^In variable definition// //^In the left operand of operation// //Reference to a value was expected instead of type `@oop_SE.C5'// var boolean x2 := C5.g(); //^In variable definition// //Reference to a value was expected instead of type `@oop_SE.C5'// } } function f_init_values() { //^In function definition// var integer v_int := 3; var template integer vt_int := (1..10); var C4 v1 := 1; //^In variable definition// //class value was expected// var C4 v2 := v_int; //^In variable definition// //Type mismatch\: a value of type `@oop_SE.C4' was expected instead of `integer'// var C4 v3 := valueof(vt_int) + v_int; //^In variable definition// //Incompatible value\: `@oop_SE.C4' value was expected// var C4 v4 := CT_RunsOn.create; //^In variable definition// //Incompatible value\: `@oop_SE.C4' value was expected// var C4 v5 := C11.create; //^In variable definition// //Incompatible class types\: operation `create' should refer to `@oop_SE.C4' instead of `@oop_SE.C11'// } type class C16 extends C15 { //^In type definition// create() : C15(1) { } //Previous definition of `create' is here// create(in integer p) : C15(p) { } //Duplicate definition with name `create'// } type class C17 { //^In type definition// create() : C15(1) { } //^In constructor definition// //^In super-constructor call// //Class type `@oop_SE.C17' does not have a superclass// } type class C18 extends C15 { //^In type definition// create() : C16() { } //^In constructor definition// //^In super-constructor call// //expected call to constructor of class type `@oop_SE.C15', instead of class type `@oop_SE.C16'// } type class C19 extends C15 { //^In type definition// create() { } //^In constructor definition// //Missing super-constructor call// } type class C20 extends C15 { //^In type definition// create() : f_embedded_types() { } //^In constructor definition// //^In super-constructor call// //Reference to constructor was expected instead of function// } function f_create() { //^In function definition// var C0 x1 := C0.create alive; //^In variable definition// //Keyword `alive' cannot be used when creating an object of class type// var Comp c1 := Comp.create("a", "b", "c"); //^In variable definition// //Operation `create' for a component type cannot have more than 2 parameters// var Comp c2 := Comp.create(? length (3)); //^In variable definition// //A specific value without matching symbols was expected for the first parameter of operation `create'// var Comp c3 := Comp.create("a", *); //^In variable definition// //A specific value without matching symbols was expected for the second parameter of operation `create'// } type class @final @abstract C21 { } //^In type definition// //Final classes cannot be abstract// type class @final C22 { } type class C23 extends C22 { } //^In type definition// //^In superclass definition// //The superclass cannot be final// type class @abstract C24 { //^In type definition// public function @abstract f1(in Nonexistent a); //^In abstract function definition// //^In formal parameter list// //^In parameter// //There is no local or imported definition with name `Nonexistent'// public function @abstract f2() return template Nonexistent; //^In abstract function definition// //^In return type// //There is no local or imported definition with name `Nonexistent'// public function @abstract f3() return Port; //^In abstract function definition// //^In return type// //Port type `@oop_SE.Port' cannot be the return type of an abstract function// } function f_inst_abstract() { //^In function definition// var C24 x := C24.create; //^In variable definition// //Cannot create an instance of abstract class type `@oop_SE.C24'// } type class @abstract C25 { public function @abstract f_abs(inout template integer p) return integer; } type class @abstract C26 extends C25 { public function @abstract f_abs2(); } type class C27 extends C26 { } //^In type definition// //Missing implementation of abstract method `@oop_SE.C25.f_abs'// //Missing implementation of abstract method `@oop_SE.C26.f_abs2'// type class C28 extends C25 { //^In type definition// var integer f_abs; //variable `@oop_SE.C28.f_abs' shadows inherited method `@oop_SE.C25.f_abs'// } type class C29 extends C26 { //^In type definition// //Missing implementation of abstract method `@oop_SE.C25.f_abs'// public function f_abs2() { } } type class C30 extends C26 { public function f_abs(inout template integer p) return integer { return 1; } public function f_abs2() { } } type class C31 extends C25 { //^In type definition// public function f_abs(in template integer p) { } //The prototype of method `f_abs' is not identical to that of inherited method `@oop_SE.C25.f_abs'// } type class C32 extends C25 { //^In type definition// public function f_abs(inout integer p) { } //The prototype of method `f_abs' is not identical to that of inherited method `@oop_SE.C25.f_abs'// } type class C33 extends C25 { //^In type definition// public function f_abs(inout template integer q) { } //The prototype of method `f_abs' is not identical to that of inherited method `@oop_SE.C25.f_abs'// } type class C34 extends C25 { //^In type definition// public function f_abs(inout template integer p) return boolean { return false; } //The prototype of method `f_abs' is not identical to that of inherited method `@oop_SE.C25.f_abs'// } type class @abstract C35 { public function @abstract f(in object p) return object; } type class C36 extends C35 { public function f(in object p) return object { return p; } } type class C37 { const integer c := 3; template charstring t := ""; public function f1() return Rec { return { 2, "a" }; } public function f2() return template charstring { return ?; } create() {} } function f_global_left_hand_side() { //^In function definition// var C37 x := C37.create; x.f1() := { 3, "b" }; //^In variable assignment// //Reference to a variable or template variable was expected instead of function `@oop_SE.C37.f1'// x.f1().num := 3; //^In variable assignment// //Reference to a variable or template variable was expected instead of function `@oop_SE.C37.f1'// x.f2() := "x"; //^In variable assignment// //Reference to a variable or template variable was expected instead of function `@oop_SE.C37.f2'// } type class C38 extends C37 { //^In type definition// public function f1() return Rec { return { 3, "b" }; } public function f2() return template charstring { return omit; } function f_class_left_hand_side() { //^In function definition// var C37 x := C37.create; x.c := 2; //^In variable assignment// //Reference to a variable or template variable was expected instead of constant `@oop_SE.C37.c'// x.t := *; //^In variable assignment// //Reference to a variable or template variable was expected instead of template `@oop_SE.C37.t'// this := null; //^In variable assignment// //Reference to a variable or template variable was expected instead of type `@oop_SE.C38'// this.c := 4; //^In variable assignment// //Reference to a variable or template variable was expected instead of constant `@oop_SE.C37.c'// this.t := ?; //^In variable assignment// //Reference to a variable or template variable was expected instead of template `@oop_SE.C37.t'// this.f1().str := "x"; //^In variable assignment// //Reference to a variable or template variable was expected instead of function `@oop_SE.C38.f1'// this.f2() := ?; //^In variable assignment// //Reference to a variable or template variable was expected instead of function `@oop_SE.C38.f2// super.f1().str := "x"; //^In variable assignment// //Reference to a variable or template variable was expected instead of function `@oop_SE.C38.f1'// super.f2() := ?; //^In variable assignment// //Reference to a variable or template variable was expected instead of function `@oop_SE.C38.f2// } } type class C39 { public function f_def(in integer p := 3) return integer { return p; } } function f_default() { //^In function definition// var C39 x := C39.create; var integer ret1 := x.f_def; //^In variable definition// //Invalid reference to method `f_def' in class type `@oop_SE.C39', reference to a member was expected instead// var integer ret2 := x.f_def(); } type external class C40 { create(in integer x); function f1(in integer p) return octetstring; external function f2(); } type external class C41 extends C40 { //^In type definition// create(); const charstring c := "a"; //An external class cannot contain a constant// template charstring t := "b"; //An external class cannot contain a template// var charstring v; //An external class cannot contain a variable// var template charstring vt; //An external class cannot contain a template variable// timer tmr; //An external class cannot contain a timer// function g1() { } //An external class cannot contain a function// function g2(in charstring x) return charstring { return x; } //An external class cannot contain a function// function g3() return template charstring { return ?; } //An external class cannot contain a function// } type external class @abstract C42 { //^In type definition// //External classes cannot be abstract// function @abstract f(); //An external class cannot contain a function// } type external class C43 extends C39 { } //^In type definition// //^In superclass definition// //An external class cannot extend an internal class// type class C44 extends C40 { //^In type definition// external function f(); create(); //^In constructor definition// //Missing super-constructor call// //Missing constructor body// } type class C45 { //^In type definition// function f(); //^In external function definition// //Missing function body or `external' keyword// } type class C46 extends object { } type class C47 { const integer m1 := 3; public function m2() return boolean { return true; } function m3(in integer p) return charstring { return int2str(p); } function @final m4() { } } type class C48 extends C47 { //^In type definition// var template octetstring m1; //template variable `@oop_SE.C48.m1' shadows inherited member `@oop_SE.C47.m1'// var integer m2; //variable `@oop_SE.C48.m2' shadows inherited method `@oop_SE.C47.m2'// function m3() return charstring { return "1"; } //The prototype of method `m3' is not identical to that of inherited method `@oop_SE.C47.m3'// function m4() { } //Cannot override final method `@oop_SE.C47.m4'// } type class C49 extends C40 { function f1(in integer p) return octetstring { return int2oct(p, 2); } function f2() { } } function f_of_operator() { //^In function definition// var C0 x := C0.create; if (x of object) { log(1); } if (x of C0) { log(2); } if (x of C5) { log(3); } //^In if statement// //Control never reaches this code because the conditional expression evaluates to false// if (x of Comp) { log(4); } //^In if statement// //^In the second operand of operation `of'// //Class type was expected// if (C0 of C0) { log(5); } //^In if statement// //^In the first operand of operation `of'// //Reference to a variable or value parameter was expected instead of type `@oop_SE.C0'// } function f_select_class() { //^In function definition// var C0 x := C0.create; select class (x) { //^In select class statement// case (C0) { log(1); } case (C5) { log(2); } //^In select class case statement// //Control never reaches this code because the case will never be chosen// case else { log(3); } case (Comp) { log(4); } //^In select class case statement// //Control never reaches this code because of previous effective case\(s\)// //Class type was expected// } var integer y; select class (y) { //^In select class statement// //Reference to a class object was expected// case (object) { log(5); } case else { log(6); } } } function f_casting() { //^In function definition// var C35 x1 := C36.create; var C36 x2 := x1 => C36; var C0 x3 := x1 => C0; //^In variable definition// //^In the second operand of operation `=>'// //Cannot cast an object of class type `@oop_SE.C35' to class type `@oop_SE.C0'// var C35 x4 := x2 => (x1); var C36 x5 := c => C36; //^In variable definition// //^In the first operand of operation `=>'// //Reference to a variable or value parameter was expected instead of constant `@oop_SE.c'// var Rec x6 := x1 => Rec; //^In variable definition// //^In the second operand of operation `=>'// //Class type was expected// var integer x7 := x1 => (x6); //^In variable definition// //^In the second operand of operation `=>'// //Class type was expected// } function f_parameters(in boolean p1, inout boolean p2, out boolean p3) { } function f_param_test() { //^In function definition// var C47 x := C47.create(1); f_parameters(x.m2(), x.m2(), x.m2()); //^In function instance// //^In actual parameter list of function// //^In parameter #2// //^In parameter #3// //Reference to a variable or value parameter was expected for an \`inout\' value parameter instead of function// //Reference to a variable or value parameter was expected for an \`out\' value parameter instead of function// } function f_class_param(in C39 x) runs on Comp { } function f_start_comp() { //^In function definition// var Comp ct := Comp.create alive; var C39 x := C39.create; ct.start(x.f_def(1)); //^In start test component statement// //A method of a class cannot be started on a parallel test component// ct.done; ct.start(f_class_param(x)); //^In start test component statement// //Function `@oop_SE.f_class_param' cannot be started on a parallel test component because parameter `x' is of a class type// ct.done; } type C47 C47_alias; //^In type definition// //Subtyping is not allowed for class type// type C47_alias C47_alias_alias; //^In type definition// //Subtyping is not allowed for class type// function f_aliases() { var C47_alias x1 := C47_alias.create(1); var C47_alias_alias x2 := C47_alias_alias.create(2); } function f_exception1(in integer p) return integer exception(integer, charstring, Rec, C0) { return p; } function f_exception2() exception(boolean, verdicttype, integer, SmallNumber, RoI, Uni, anytype, Comp, RoI[-], Rec.num, Uni.i, Enum) { } external function ef_exception1(in integer p) return integer exception(integer, charstring, Rec, C0); altstep a_exception1(in integer p) runs on Comp exception(integer, charstring, Rec, C0) { [] c_timer.timeout { } } function f_exception3() //^In function definition// exception (float, //^In exception list// default, //Default type cannot be on the exception list of a function// bitstring, Port, //Port type `@oop_SE.Port' cannot be on the exception list of a function// hexstring, Sig, //Signature `@oop_SE.Sig' cannot be on the exception list of a function// octetstring) { } external function ef_exception2() //^In external function definition// exception (universal charstring, //^In exception list// //Type `universal charstring' is already given here// integer, universal charstring); //Duplicate type in exception list// function f_raise(in integer p, inout template integer p2) runs on CT_Mtc { //^In function definition// //Previous definition with identifier `p' in higher scope unit is here// if (p == 0) { raise 3; } if (p == 1) { raise Enum: E2; } if (p == 2) { raise int2char(p + 1); } if (p == 3) { raise omit; } //^In if statement// //^In raise statement// //Cannot determine the type of the raised exception.// if (p == 4) { raise null; } //^In if statement// //^In raise statement// //Cannot determine the type of the raised exception.// if (p == 5) { raise pattern "ab?c"; } //^In if statement// //^In raise statement// //A specific value without matching symbols or a reference to a value was expected for a raised exception.// var default def := null; if (p == 6) { raise def; } //^In if statement// //^In raise statement// //Cannot raise an exception of type default// if (p == 7) { raise Sig: { p }; } //^In if statement// //^In raise statement// //Cannot raise an exception of type @oop_SE.Sig// if (p == 8) { raise pt; } //^In if statement// //^In raise statement// //Reference to a value was expected instead of port `@oop_SE.CT_Mtc.pt'// var template charstring vt := ? length (3); if (p == 9) { raise vt; } //^In if statement// //^In raise statement// //A specific value without matching symbols or a reference to a value was expected for a raised exception.// if (p == 10) { raise c; } if (p == 11) { raise t; } //^In if statement// //^In raise statement// //A specific value without matching symbols or a reference to a value was expected for a raised exception.// if (p == 12) { raise p2; } //^In if statement// //^In raise statement// //A specific value without matching symbols or a reference to a value was expected for a raised exception.// } catch (integer x) { } //Catch block for the same exception type already defined here// catch (integer y) { } //Duplicate catch block definition for exception type `integer'// catch (SmallNumber x) { } catch (RoI[-] x) { } catch (Rec.num x) { } catch (charstring p) { } //Definition with identifier `p' is not unique in the scope hierarchy// catch (default x) { } //^In exception definition// //Exception cannot be defined for the default type// catch (Sig x) { } //^In exception definition// //Exception cannot be defined for signature `@oop_SE.Sig'// catch (Port x) { } //^In exception definition// //Exception cannot be defined for port type `@oop_SE.Port'// catch (octetstring x) { return; } finally { raise 3; //^In raise statement// //Raise statement cannot be used inside a finally block or the destructor of a class.// } function f_return1(in integer p) return integer { //^In function definition// if (p > 0) { return 0; } else { raise 0; } } catch (integer x) { return x; } finally { return -1; //^In return statement// //Return statement cannot be used inside a finally block or the destructor of a class.// } function f_return2(in integer p) return integer { //^In function definition// //The function has return type, but control might leave it without reaching a return statement// if (p > 0) { return f_return1(p); } catch (integer x) { log(x); } else { raise 0; } } type class C50 { } //^In type definition// finally { //^In class destructor// return; //^In return statement// //Return statement cannot be used inside a finally block or the destructor of a class.// } type class C51 { } //^In type definition// finally { //^In class destructor// raise 1.0; //^In raise statement// //Raise statement cannot be used inside a finally block or the destructor of a class.// } control { //^In control part// var C11 x := C11.create; //^In variable definition// //A definition without `runs on' clause cannot create a value of class type `@oop_SE.C11', which runs on component type `@oop_SE.CT_RunsOn'// //Cannot create value of class type `@oop_SE.C11', which has an `mtc' clause, in the control part.// //Cannot create value of class type `@oop_SE.C11', which has a `system' clause, in the control part.// raise "abc"; //^In raise statement// //Raise statement cannot be used in the control part. It is allowed only in functions, altsteps and testcases.// } } with { extension "anytype C0, object" //^In anytype field// //Class type `@oop_SE.C0' cannot be embedded into another type// //Class type `object' cannot be added to the anytype// }