[vala/0.34] vala: Slightly improve lamdba-expression error on target-type mismatch



commit 695e5c73d3eec905103d294a8825e6699b2e50fc
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Mar 22 14:39:32 2017 +0100

    vala: Slightly improve lamdba-expression error on target-type mismatch

 vala/valalambdaexpression.vala |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala
index 1d6f957..d194eca 100644
--- a/vala/valalambdaexpression.vala
+++ b/vala/valalambdaexpression.vala
@@ -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;
                }
 


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