[vala/staging: 1/7] vala: Use dedicated error message for assignments to literals



commit c498bf05bf55f5ff7c0e0c903db4139f536488bb
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Jan 7 17:47:49 2019 +0100

    vala: Use dedicated error message for assignments to literals

 vala/valaassignment.vala | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index ce3549aaf..1c449ed74 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -208,6 +208,10 @@ public class Vala.Assignment : Expression {
                        }
                } else if (left is PointerIndirection) {
                        right.target_type = left.value_type.copy ();
+               } else if (left is Literal) {
+                       error = true;
+                       Report.error (source_reference, "Literals are immutable");
+                       return false;
                } else {
                        error = true;
                        Report.error (source_reference, "unsupported lvalue in assignment");


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