diff --git a/compiler2/Type.cc b/compiler2/Type.cc index b007334b4b4764b316da6b3df8c165f25a071cb9..3350026510da15270d6eb459c714b2270a410aa4 100644 --- a/compiler2/Type.cc +++ b/compiler2/Type.cc @@ -3714,7 +3714,7 @@ namespace Common { } ComponentTypeBody* b1 = t1->get_CompBody(); ComponentTypeBody* b2 = t2->get_CompBody(); - + // Does b2 contains every port with the same type and name as b1? for (size_t i = 0; i < b1->get_nof_asss(); i++) { Assignment * ass = b1->get_ass_byIndex(i); @@ -3741,32 +3741,6 @@ namespace Common { } } - // Does b1 contains every port with the same type and name as b2? - for (size_t i = 0; i < b2->get_nof_asss(); i++) { - Assignment * ass = b2->get_ass_byIndex(i); - if (ass->get_asstype() == Assignment::A_PORT) { - Type *port_type = ass->get_Type()->get_type_refd_last(); - const Identifier& id = ass->get_id(); - bool found = false; - for (size_t j = 0; j < b1->get_nof_asss(); j++) { - Assignment * ass2 = b1->get_ass_byIndex(j); - const Identifier& id2 = ass2->get_id(); - if (id == id2 && ass2->get_asstype() == Assignment::A_PORT) { - Type *port_type2 = ass2->get_Type()->get_type_refd_last(); - if (port_type != port_type2) { - return false; - } else { - found = true; - break; - } - } - } - if (!found) { - return false; - } - } - } - return true; } diff --git a/function_test/Semantic_Analyser/mtc_and_system_clause/MtcSystemClause_SE.ttcn b/function_test/Semantic_Analyser/mtc_and_system_clause/MtcSystemClause_SE.ttcn index ddb37f5d19700609e79d8fb3d19f496c60ac9678..9b8a77654d439f9ffb5e31d8b2d2e98234447656 100644 --- a/function_test/Semantic_Analyser/mtc_and_system_clause/MtcSystemClause_SE.ttcn +++ b/function_test/Semantic_Analyser/mtc_and_system_clause/MtcSystemClause_SE.ttcn @@ -25,6 +25,13 @@ module MtcSystemClause_SE { //^In TTCN-3 module// } type component Comp2 { + var integer i; + port P1 p1; + port P1 p2; /* Different name */ + timer mytimer; + } + + type component Comp3 { var integer i; port P1 p2; /* Different name */ timer mytimer; @@ -57,19 +64,38 @@ module MtcSystemClause_SE { //^In TTCN-3 module// } } - altstep alt_diff_mtc_bad() runs on Comp2 mtc Comp1 { + altstep alt_diff_mtc2() runs on Comp2 mtc Comp1 { + []mytimer.timeout{ + + } + } + + altstep alt_diff_system2() runs on Comp2 system Comp1 { + []mytimer.timeout{ + + } + } + + + altstep alt_diff_mtc_and_system2() runs on Comp2 mtc Comp1 system Comp1 { []mytimer.timeout{ } } - altstep alt_diff_system_bad() runs on Comp2 system Comp1 { + altstep alt_diff_mtc_bad() runs on Comp3 mtc Comp1 { []mytimer.timeout{ } } - altstep alt_diff_mtc_and_system_bad() runs on Comp2 mtc Comp1 system Comp1 { + altstep alt_diff_system_bad() runs on Comp3 system Comp1 { + []mytimer.timeout{ + + } + } + + altstep alt_diff_mtc_and_system_bad() runs on Comp3 mtc Comp1 system Comp1 { []mytimer.timeout{ } @@ -87,14 +113,24 @@ module MtcSystemClause_SE { //^In TTCN-3 module// alt_diff_mtc_and_system(); } - testcase tc_negative() runs on Comp2 system Comp2 { //^In testcase definition \`tc_negative\'\:// - diff_mtc(); //^In function instance\:// //^error\: Mtc clause mismatch\: A definition that runs on component type \`\@MtcSystemClause_SE\.Comp2\' cannot call function \`\@MtcSystemClause_SE\.diff_mtc\'\, which mtc clause is \`\@MtcSystemClause_SE\.Comp1\'// - diff_system(); //^In function instance\:// //^error\: System clause mismatch\: A definition with system component type \`\@MtcSystemClause_SE\.Comp2\' cannot call function \`\@MtcSystemClause_SE\.diff_system\'\, which system clause is \`\@MtcSystemClause_SE\.Comp1\'// - diff_mtc_and_system(); //^In function instance\:// //^error\: System clause mismatch\: A definition with system component type \`\@MtcSystemClause_SE\.Comp2\' cannot call function \`\@MtcSystemClause_SE\.diff_mtc_and_system\'\, which system clause is \`\@MtcSystemClause_SE\.Comp1\'// //^error\: Mtc clause mismatch\: A definition that runs on component type \`\@MtcSystemClause_SE\.Comp2\' cannot call function \`\@MtcSystemClause_SE\.diff_mtc_and_system\'\, which mtc clause is \`\@MtcSystemClause_SE\.Comp1\'// + testcase tc_positive2() runs on Comp2 system Comp2 { + diff_mtc(); + diff_system(); + diff_mtc_and_system(); + + alt_diff_mtc2(); + alt_diff_system2(); + alt_diff_mtc_and_system2(); + } + + testcase tc_negative() runs on Comp3 system Comp3 { //^In testcase definition \`tc_negative\'\:// + diff_mtc(); //^In function instance\:// //^error\: Mtc clause mismatch\: A definition that runs on component type \`\@MtcSystemClause_SE\.Comp3\' cannot call function \`\@MtcSystemClause_SE\.diff_mtc\'\, which mtc clause is \`\@MtcSystemClause_SE\.Comp1\'// + diff_system(); //^In function instance\:// //^error\: System clause mismatch\: A definition with system component type \`\@MtcSystemClause_SE\.Comp3\' cannot call function \`\@MtcSystemClause_SE\.diff_system\'\, which system clause is \`\@MtcSystemClause_SE\.Comp1\'// + diff_mtc_and_system(); //^In function instance\:// //^error\: System clause mismatch\: A definition with system component type \`\@MtcSystemClause_SE\.Comp3\' cannot call function \`\@MtcSystemClause_SE\.diff_mtc_and_system\'\, which system clause is \`\@MtcSystemClause_SE\.Comp1\'// //^error\: Mtc clause mismatch\: A definition that runs on component type \`\@MtcSystemClause_SE\.Comp3\' cannot call function \`\@MtcSystemClause_SE\.diff_mtc_and_system\'\, which mtc clause is \`\@MtcSystemClause_SE\.Comp1\'// - alt_diff_mtc_bad(); //^In altstep instance\:// //^error\: Mtc clause mismatch\: A definition that runs on component type \`\@MtcSystemClause_SE\.Comp2\' cannot call altstep \`\@MtcSystemClause_SE\.alt_diff_mtc_bad\'\, which mtc clause is \`\@MtcSystemClause_SE\.Comp1\'// - alt_diff_system_bad(); //^In altstep instance\:// //^error\: System clause mismatch\: A definition with system component type \`\@MtcSystemClause_SE\.Comp2\' cannot call altstep \`\@MtcSystemClause_SE\.alt_diff_system_bad\'\, which system clause is \`\@MtcSystemClause_SE\.Comp1\'// - alt_diff_mtc_and_system_bad(); //^In altstep instance\:// //^error\: System clause mismatch\: A definition with system component type \`\@MtcSystemClause_SE\.Comp2\' cannot call altstep \`\@MtcSystemClause_SE\.alt_diff_mtc_and_system_bad\'\, which system clause is \`\@MtcSystemClause_SE\.Comp1\'// //^error\: Mtc clause mismatch\: A definition that runs on component type \`\@MtcSystemClause_SE\.Comp2\' cannot call altstep \`\@MtcSystemClause_SE\.alt_diff_mtc_and_system_bad\'\, which mtc clause is \`\@MtcSystemClause_SE\.Comp1\'// + alt_diff_mtc_bad(); //^In altstep instance\:// //^error\: Mtc clause mismatch\: A definition that runs on component type \`\@MtcSystemClause_SE\.Comp3\' cannot call altstep \`\@MtcSystemClause_SE\.alt_diff_mtc_bad\'\, which mtc clause is \`\@MtcSystemClause_SE\.Comp1\'// + alt_diff_system_bad(); //^In altstep instance\:// //^error\: System clause mismatch\: A definition with system component type \`\@MtcSystemClause_SE\.Comp3\' cannot call altstep \`\@MtcSystemClause_SE\.alt_diff_system_bad\'\, which system clause is \`\@MtcSystemClause_SE\.Comp1\'// + alt_diff_mtc_and_system_bad(); //^In altstep instance\:// //^error\: System clause mismatch\: A definition with system component type \`\@MtcSystemClause_SE\.Comp3\' cannot call altstep \`\@MtcSystemClause_SE\.alt_diff_mtc_and_system_bad\'\, which system clause is \`\@MtcSystemClause_SE\.Comp1\'// //^error\: Mtc clause mismatch\: A definition that runs on component type \`\@MtcSystemClause_SE\.Comp3\' cannot call altstep \`\@MtcSystemClause_SE\.alt_diff_mtc_and_system_bad\'\, which mtc clause is \`\@MtcSystemClause_SE\.Comp1\'// }