[vala/0.34] method: Include owndership transfer classifier for return-type mismatch
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.34] method: Include owndership transfer classifier for return-type mismatch
- Date: Thu, 5 Oct 2017 20:36:16 +0000 (UTC)
commit 43a6b6b13ca196eaf53666d9c7000bbb5dcb1d9b
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 284412a..b503ced 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]