[vala/0.36: 68/212] method: Include owndership transfer classifier for return-type mismatch



commit af2b5ccde7a6920b0ce4f9c50cd7df5421d8abed
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Oct 5 22:14:52 2017 +0200

    method: Include owndership transfer classifier for return-type mismatch
    
    Fixes deficiency of faa7dc16046a4a002ad23c90cf4ca1f9007adaa2

 vala/valamethod.vala |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 2533389..1312b17 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -350,7 +350,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 = "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;
                }
                
@@ -1082,6 +1082,10 @@ public class Vala.Method : Subroutine, Callable {
                }
                return -1;
        }
+
+       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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]