]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
method: Include owndership transfer classifier for return-type mismatch
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 5 Oct 2017 20:14:52 +0000 (22:14 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 5 Oct 2017 20:31:37 +0000 (22:31 +0200)
Fixes deficiency of faa7dc16046a4a002ad23c90cf4ca1f9007adaa2

vala/valamethod.vala

index 284412a136fb4ebc4b57534197c352f02f148410..b503ced460ceba78321f5e78d88708ad07510410 100644 (file)
@@ -350,7 +350,7 @@ public class Vala.Method : Subroutine {
 
                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 = "Base method expected return type `%s', but `%s' was provided".printf (actual_base_type.to_qualified_string (), return_type.to_qualified_string ());
+                       invalid_match = "Base method expected return type `%s', but `%s' was provided".printf (type_to_prototype_string (actual_base_type), type_to_prototype_string (return_type));
                        return false;
                }
                
@@ -1073,6 +1073,10 @@ public class Vala.Method : Subroutine {
                        get_captured_variables ((Collection<LocalVariable>) collection);
                }
        }
+
+       private static string type_to_prototype_string (DataType type) {
+               return "%s%s".printf (type.is_weak () ? "unowned " : "", type.to_qualified_string ());
+       }
 }
 
 // vim:sw=8 noet