]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Error when lambda parameter has incompatible direction with the delegate
authorLuca Bruno <lucabru@src.gnome.org>
Thu, 4 Dec 2014 14:23:44 +0000 (15:23 +0100)
committerLuca Bruno <lucabru@src.gnome.org>
Thu, 4 Dec 2014 14:24:31 +0000 (15:24 +0100)
Fixes bug 740894

vala/valalambdaexpression.vala

index 61482f42a6f4416ab43816e4c1078384e506280e..6918710568eb047c008118d17ab3deadc6f2a707 100644 (file)
@@ -183,6 +183,12 @@ public class Vala.LambdaExpression : Expression {
                        }
 
                        Parameter lambda_param = lambda_param_it.get ();
+
+                       if (lambda_param.direction != cb_param.direction) {
+                               error = true;
+                               Report.error (lambda_param.source_reference, "direction of parameter `%s' is incompatible with the target delegate".printf (lambda_param.name));
+                       }
+
                        lambda_param.variable_type = cb_param.variable_type.get_actual_type (target_type, null, this);
                        method.add_parameter (lambda_param);
                }