Commit 339d8d04 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

OOP: aliases for class types are no longer allowed (bug 568745, 568899)


Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
Change-Id: I3ef81abf7e118384f0edf0cf29f281a86065a6c4
parent 34b11bc1
...@@ -3634,6 +3634,9 @@ void Type::chk_refd() ...@@ -3634,6 +3634,9 @@ void Type::chk_refd()
checked=true; checked=true;
ReferenceChain refch(this, "While checking referenced type"); ReferenceChain refch(this, "While checking referenced type");
Type* t_last = get_type_refd_last(&refch); Type* t_last = get_type_refd_last(&refch);
if (ownertype == OT_TYPE_DEF && t_last->typetype == T_CLASS) {
error("Subtyping is not allowed for class type `%s'", t_last->get_typename().c_str());
}
u.ref.component_internal = t_last->is_component_internal(); u.ref.component_internal = t_last->is_component_internal();
} }
......
...@@ -1166,7 +1166,7 @@ module NegSem_50101_top_level_005 "TTCN-3:2018 Object-Oriented"{ ...@@ -1166,7 +1166,7 @@ module NegSem_50101_top_level_005 "TTCN-3:2018 Object-Oriented"{
<END_MODULE> <END_MODULE>
<RESULT COUNT> <RESULT COUNT>
error: error: Subtyping is not allowed for class type
<END_RESULT> <END_RESULT>
<END_TC> <END_TC>
......
...@@ -536,6 +536,15 @@ function f_start_comp() { //^In function definition// ...@@ -536,6 +536,15 @@ function f_start_comp() { //^In function definition//
} }
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);
}
control { //^In control part// 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.// 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.//
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment