]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Slightly improve lamdba-expression error on target-type mismatch
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 22 Mar 2017 13:39:32 +0000 (14:39 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 22 Mar 2017 13:59:53 +0000 (14:59 +0100)
vala/valalambdaexpression.vala

index 1d6f95713ca0f8802019b09f20851698c7beb3bc..d194eca6f8514e57c31b8abd3663e809000745bd 100644 (file)
@@ -128,7 +128,11 @@ public class Vala.LambdaExpression : Expression {
 
                if (!(target_type is DelegateType)) {
                        error = true;
-                       Report.error (source_reference, "lambda expression not allowed in this context");
+                       if (target_type != null) {
+                               Report.error (source_reference, "Cannot convert lambda expression to `%s'".printf (target_type.to_string ()));
+                       } else {
+                               Report.error (source_reference, "lambda expression not allowed in this context");
+                       }
                        return false;
                }