[vala/0.34] codegen: Fix return-type for cancelled async creation methods of classes
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.34] codegen: Fix return-type for cancelled async creation methods of classes
- Date: Tue, 30 Jan 2018 07:25:02 +0000 (UTC)
commit 3b4e5e29840bc04211218b989ceec8721f32d84c
Author: Ernestas Kulik <ernestask gnome org>
Date: Sat Jan 27 15:42:56 2018 +0200
codegen: Fix return-type for cancelled async creation methods of classes
While gcc just puts out a warning clang actually fails due to
-Werror=return-type.
https://bugzilla.gnome.org/show_bug.cgi?id=792942
codegen/valagasyncmodule.vala | 1 +
tests/Makefile.am | 1 +
tests/asynchronous/bug792942.vala | 15 +++++++++++++++
3 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index c23a3a0..1e9748e 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -514,6 +514,7 @@ public class Vala.GAsyncModule : GtkModule {
var type_sym = (TypeSymbol) m.parent_symbol;
if (type_sym is ObjectTypeSymbol) {
ccode.add_declaration (get_ccode_name (type_sym) + "*", new
CCodeVariableDeclarator ("result"));
+ return_type = ((ObjectTypeSymbol) type_sym).get_this_type ();
}
} else if (!(return_type is VoidType) && !return_type.is_real_non_null_struct_type ()) {
ccode.add_declaration (get_ccode_name (m.return_type), new CCodeVariableDeclarator
("result"));
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 45c3a3a..95b1b7d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -239,6 +239,7 @@ TESTS = \
asynchronous/bug742621.vala \
asynchronous/bug762819.vala \
asynchronous/bug792660.vala \
+ asynchronous/bug792942.vala \
asynchronous/closures.vala \
dbus/basic-types.test \
dbus/arrays.test \
diff --git a/tests/asynchronous/bug792942.vala b/tests/asynchronous/bug792942.vala
new file mode 100644
index 0000000..5104f05
--- /dev/null
+++ b/tests/asynchronous/bug792942.vala
@@ -0,0 +1,15 @@
+class Foo {
+ public async Foo () throws Error {
+ }
+}
+
+async void run () {
+ try {
+ var foo = yield new Foo ();
+ } catch {
+ }
+}
+
+void main () {
+ run.begin ();
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]