diff --git a/compiler2/ttcn3/AST_ttcn3.cc b/compiler2/ttcn3/AST_ttcn3.cc index 7363b51d675d8fc1104583f0f99ccd79d18e6e38..1a44815077ebe121b7ffd0144b6b1d777b9c2c0f 100644 --- a/compiler2/ttcn3/AST_ttcn3.cc +++ b/compiler2/ttcn3/AST_ttcn3.cc @@ -1418,7 +1418,9 @@ namespace Ttcn { Common::Assignment *RunsOnScope::get_ass_bySRef(Ref_simple *p_ref) { if (!p_ref) FATAL_ERROR("Ttcn::RunsOnScope::get_ass_bySRef()"); - if (p_ref->get_modid()) return parent_scope->get_ass_bySRef(p_ref); + if (p_ref->get_modid() || p_ref->get_reftype() != Ref_simple::REF_BASIC) { + return parent_scope->get_ass_bySRef(p_ref); + } else { const Identifier& id = *p_ref->get_id(); if (component_defs->has_local_ass_withId(id)) { @@ -3667,12 +3669,6 @@ namespace Ttcn { delete t; continue; } - else if (t->get_type_refd_last()->get_typetype() == Type::T_CLASS) { - ea.error("Class type `%s' cannot be added to the anytype", - t->get_typename().c_str()); - delete t; - continue; - } string field_name; const char* btn = Type::get_typename_builtin(t->get_typetype()); @@ -4206,6 +4202,10 @@ namespace Ttcn { error("Type of module parameter cannot be signature `%s'", t->get_fullname().c_str()); break; + case Type::T_CLASS: + error("Type of module parameter cannot be or embed class type `%s'", + t->get_fullname().c_str()); + break; case Type::T_FUNCTION: case Type::T_ALTSTEP: case Type::T_TESTCASE: @@ -4214,10 +4214,6 @@ namespace Ttcn { " `%s' which has runs on self clause", t->get_fullname().c_str()); break; } - case Type::T_CLASS: - error("Type of module parameter cannot be or embed class type `%s'", - t->get_fullname().c_str()); - break; default: #if defined(MINGW) checked = true; diff --git a/function_test/Semantic_Analyser/Makefile.semantic b/function_test/Semantic_Analyser/Makefile.semantic index 5fc093bc20e7a9f53fdeb65ad138a8febc6228e1..e36e6ad41ec9a8bde4d211dab3ec5d02801c5be0 100644 --- a/function_test/Semantic_Analyser/Makefile.semantic +++ b/function_test/Semantic_Analyser/Makefile.semantic @@ -16,7 +16,7 @@ include ../../Makefile.personal SADIRS := ver param template any_from pattern_ref float recof_index \ port_translation mtc_and_system_clause port_map_connect deterministic invoking_function_from_specific_places \ -json realtime map_param +json realtime map_param oop ifdef RT2 SADIRS += deprecated erroneous_attributes template_concat endif diff --git a/function_test/Semantic_Analyser/oop/oop_SE.ttcn b/function_test/Semantic_Analyser/oop/oop_SE.ttcn index 42a4732a5cc6799a7285faa759e1519a32572e84..b7d6129fe63c8d13c3de1c5605ae81064317b24a 100644 --- a/function_test/Semantic_Analyser/oop/oop_SE.ttcn +++ b/function_test/Semantic_Analyser/oop/oop_SE.ttcn @@ -159,7 +159,7 @@ function f_embedded_types() { //^In function definition// 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; //^In variable assignment// //Reference to non-existent field `C0' in type `@oop_SE.anytype'// + v_any.C0 := C0.create; } @@ -213,5 +213,5 @@ type class C10 runs on CT_RunsOn mtc CT_Mtc system CT_System { //^In type defini } with { - extension "anytype C0" //Class type `@oop_SE.C0' cannot be added to the anytype// + extension "anytype C0" //^In anytype field// //Class type `@oop_SE.C0' cannot be embedded into another type// }