Fixes bug 623049.
}
}
- if (m is CreationMethod && m.get_error_types ().size > 0) {
- out_arg_map.set (get_param_pos (-1), new CCodeIdentifier ("error"));
- } else if (expr.tree_can_fail) {
+ if (expr.tree_can_fail) {
// method can fail
current_method_inner_error = true;
// add &inner_error before the ellipsis arguments
if (current_method is CreationMethod) {
var cl = current_method.parent_symbol as Class;
- var unref_call = new CCodeFunctionCall (new CCodeIdentifier (cl.get_unref_function ()));
- unref_call.add_argument (new CCodeIdentifier ("self"));
+ var unref_call = get_unref_expression (new CCodeIdentifier ("self"), new ObjectType (cl), null);
cerror_block.add_statement (new CCodeExpressionStatement (unref_call));
cerror_block.add_statement (new CCodeReturnStatement (new CCodeConstant ("NULL")));
} else if (current_method != null && current_method.coroutine) {
errors/bug567181.vala \
errors/bug579101.vala \
errors/bug596228.vala \
+ errors/bug623049.vala \
asynchronous/bug595735.vala \
asynchronous/bug595755.vala \
asynchronous/bug596177.vala \
--- /dev/null
+public errordomain Foo {
+ BAR
+}
+
+class ClsA : Object {
+ public ClsA () throws Error {
+ throw new Foo.BAR ("Test");
+ }
+}
+
+class ClsB: ClsA {
+ public ClsB () throws Error {
+ base ();
+
+ assert_not_reached ();
+ }
+}
+
+void main () {
+ try {
+ new ClsB ();
+ } catch (Error e) {
+ debug ("Propagated error");
+ }
+}
value_type = formal_value_type.get_actual_type (target_object_type, call as MemberAccess, this);
}
}
+ } else if (mtype is ObjectType) {
+ // constructor
+ var cl = (Class) ((ObjectType) mtype).type_symbol;
+ var m = cl.default_construction_method;
+ foreach (DataType error_type in m.get_error_types ()) {
+ may_throw = true;
+
+ // ensure we can trace back which expression may throw errors of this type
+ var call_error_type = error_type.copy ();
+ call_error_type.source_reference = source_reference;
+
+ add_error_type (call_error_type);
+ }
} else if (mtype is DelegateType) {
var d = ((DelegateType) mtype).delegate_symbol;
foreach (DataType error_type in d.get_error_types ()) {