Skip to content
Snippets Groups Projects
Commit 7d37a297 authored by Adam Knapp's avatar Adam Knapp
Browse files

Bugfix: bug 568716 & 568742


OOP_public methods shall be overridden only by public methods (bug
568716)

OOP-protected methods may be overridden by public or protected methods
only (bug 568742)

Signed-off-by: default avatarAdam Knapp <knappadam5@gmail.com>
parent afeda039
No related branches found
No related tags found
1 merge request!153Bugfix: bug 568716 & 568742
...@@ -3472,6 +3472,17 @@ namespace Ttcn { ...@@ -3472,6 +3472,17 @@ namespace Ttcn {
local_def->error("Cannot override final method `%s'", local_def->error("Cannot override final method `%s'",
base_def->get_fullname().c_str()); base_def->get_fullname().c_str());
} }
else if (local_func->is_identical(base_func)) {
if (base_func->get_visibility() == PUBLIC && local_func->get_visibility() != PUBLIC) {
local_def->error("Public methods can be only overridden by public methods `%s'",
local_id.get_dispname().c_str());
}
else if (base_func->get_visibility() == NOCHANGE &&
(local_func->get_visibility() != PUBLIC || local_func->get_visibility() != NOCHANGE)) {
local_def->error("Protected methods can be only overridden by "
"public or protected methods `%s'", local_id.get_dispname().c_str());
}
}
break; } break; }
default: default:
local_def->error("%s shadows inherited member `%s'", local_def->error("%s shadows inherited member `%s'",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment