]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Don't try to infer error argument on async begin methods
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 4 Feb 2018 09:28:59 +0000 (10:28 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 4 Feb 2018 09:28:59 +0000 (10:28 +0100)
Only the async finish method might have an error parameter.

Regression of 527dac8050fe90d7a28619383f11e968ab5c9a77

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

codegen/valaccodemethodcallmodule.vala
tests/Makefile.am
tests/asynchronous/bug793158.vala [new file with mode: 0644]

index 3fadb27ac3f60a3d881108997d7c41a0c088dbf4..1beaa8ba436f68459643f63ac5484bf367af0c96 100644 (file)
@@ -625,7 +625,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        current_method_inner_error = true;
                        // add &inner_error before the ellipsis arguments
                        out_arg_map.set (get_param_pos (-1), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression ("_inner_error_")));
-               } else if (m != null && m.has_error_type_parameter ()) {
+               } else if (m != null && m.has_error_type_parameter () && async_call != ccall) {
                        // inferred error argument from base method
                        out_arg_map.set (get_param_pos (-1), new CCodeConstant ("NULL"));
                }
index ac4eb10853d61ec00d81eb42220872ec09adb00a..e89b338eb7363ab0d5d41b556fbc4f4079750150 100644 (file)
@@ -305,6 +305,7 @@ TESTS = \
        asynchronous/bug783543.vala \
        asynchronous/bug792660.vala \
        asynchronous/bug792942.vala \
+       asynchronous/bug793158.vala \
        asynchronous/closures.vala \
        asynchronous/generator.vala \
        asynchronous/yield.vala \
diff --git a/tests/asynchronous/bug793158.vala b/tests/asynchronous/bug793158.vala
new file mode 100644 (file)
index 0000000..445092b
--- /dev/null
@@ -0,0 +1,20 @@
+errordomain FooError {
+       BAR;
+}
+
+class Foo : Object {
+       public async bool bar () throws FooError {
+               return true;
+       }
+}
+
+MainLoop loop;
+
+void main () {
+       loop = new MainLoop ();
+       var foo = new Foo ();
+       foo.bar.begin ((o, r) => {
+               loop.quit ();
+       });
+       loop.run ();
+}