]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
method: Print encountered type if return types mismatch
authorTimm Bäder <mail@baedert.org>
Sat, 5 Nov 2016 13:02:16 +0000 (14:02 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 5 Nov 2016 20:09:37 +0000 (21:09 +0100)
If a class overrides a method of a base type, print both the encountered
return type and the return type expected by the base class.

https://bugzilla.gnome.org/show_bug.cgi?id=769501

vala/valamethod.vala

index 4c7b700cc79691bd0f2fd202c86d25f9c16e3de1..f79ec7b5ed3adccf03790d4cc9d6533b0c97a81c 100644 (file)
@@ -342,7 +342,7 @@ public class Vala.Method : Subroutine, Callable {
 
                var actual_base_type = base_method.return_type.get_actual_type (object_type, method_type_args, this);
                if (!return_type.equals (actual_base_type)) {
-                       invalid_match = "incompatible return type";
+                       invalid_match = "Base method expected return type `%s', but `%s' was provided".printf (actual_base_type.to_qualified_string (), return_type.to_qualified_string ());
                        return false;
                }