[vala/wip/transform: 177/179] tests: "??" evaluates both of sides of expression when right side throws error



commit c1c9e0122dfc7d8eb9b8fa9efaa3168c4ff20b84
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Nov 8 15:02:24 2016 +0100

    tests: "??" evaluates both of sides of expression when right side throws error
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764440

 tests/Makefile.am                 |    1 +
 tests/control-flow/bug764440.vala |   17 +++++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e5db6ec..9902c09 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -141,6 +141,7 @@ TESTS = \
        control-flow/bug691514.vala     \
        control-flow/bug736774-1.vala \
        control-flow/bug736774-2.vala \
+       control-flow/bug764440.vala \
        control-flow/bug790903.test \
        control-semantic/argument-extra.test \
        control-semantic/argument-incompatible-type-out.test \
diff --git a/tests/control-flow/bug764440.vala b/tests/control-flow/bug764440.vala
new file mode 100644
index 0000000..6f1caae
--- /dev/null
+++ b/tests/control-flow/bug764440.vala
@@ -0,0 +1,17 @@
+errordomain FooError {
+       BAR;
+}
+
+unowned string get_bar () throws FooError {
+       throw new FooError.BAR ("bar");
+}
+
+void main () {
+       try {
+               unowned string? foo = "foo";
+               unowned string bar = foo ?? get_bar ();
+               print ("%s\n", bar);
+       } catch {
+               assert_not_reached ();
+       }
+}


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