Commit 10c754b5 authored by Rico Tzschichholz's avatar Rico Tzschichholz

vala: Improve error output of mismatching overriding methods

Include the prototype-string of base-method for easier error finding.
parent 2f6d9c44
......@@ -560,7 +560,8 @@ public class Vala.Method : Subroutine, Callable {
string invalid_match;
if (!compatible (base_method, out invalid_match)) {
error = true;
Report.error (source_reference, "overriding method `%s' is incompatible with base method `%s': %s.".printf (get_full_name (), base_method.get_full_name (), invalid_match));
var base_method_type = new MethodType (base_method);
Report.error (source_reference, "overriding method `%s' is incompatible with base method `%s': %s.".printf (get_full_name (), base_method_type.to_prototype_string (), invalid_match));
return;
}
......@@ -606,7 +607,8 @@ public class Vala.Method : Subroutine, Callable {
string invalid_match = null;
if (!compatible (base_method, out invalid_match)) {
error = true;
Report.error (source_reference, "overriding method `%s' is incompatible with base method `%s': %s.".printf (get_full_name (), base_method.get_full_name (), invalid_match));
var base_method_type = new MethodType (base_method);
Report.error (source_reference, "overriding method `%s' is incompatible with base method `%s': %s.".printf (get_full_name (), base_method_type.to_prototype_string (), invalid_match));
return;
}
......@@ -618,7 +620,7 @@ public class Vala.Method : Subroutine, Callable {
}
if (base_interface_type != null) {
Report.error (source_reference, "%s: no suitable interface method found to implement".printf (get_full_name ()));
Report.error (source_reference, "`%s': no suitable interface method found to implement".printf (get_full_name ()));
}
}
......@@ -773,7 +775,7 @@ public class Vala.Method : Subroutine, Callable {
return false;
}
} else if (overrides && base_method == null) {
Report.error (source_reference, "%s: no suitable method found to override".printf (get_full_name ()));
Report.error (source_reference, "`%s': no suitable method found to override".printf (get_full_name ()));
} else if ((is_abstract || is_virtual || overrides) && access == SymbolAccessibility.PRIVATE) {
error = true;
Report.error (source_reference, "Private member `%s' cannot be marked as override, virtual, or abstract".printf (get_full_name ()));
......
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