[vala/staging: 3/3] codegen: Don't try to infer error argument on async begin methods



commit f53f56859cf5a50dff91a82ad4f48cdb6ca1ec68
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Feb 4 10:28:59 2018 +0100

    codegen: Don't try to infer error argument on async begin methods
    
    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 |    2 +-
 tests/Makefile.am                      |    1 +
 tests/asynchronous/bug793158.vala      |   20 ++++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 3fadb27..1beaa8b 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -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"));
                }
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ac4eb10..e89b338 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
index 0000000..445092b
--- /dev/null
+++ b/tests/asynchronous/bug793158.vala
@@ -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 ();
+}


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