]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix crash with invalid property default expressions
authorLevi Bard <taktaktaktaktaktaktaktaktaktak@gmail.com>
Wed, 15 Apr 2009 20:37:51 +0000 (22:37 +0200)
committerJürg Billeter <j@bitron.ch>
Wed, 15 Apr 2009 20:37:51 +0000 (22:37 +0200)
Do not check type compatibility on the default expression of a
property if it fails semantic analysis. Fixes bug 576122.

vala/valaproperty.vala
vala/valastruct.vala

index 241fd3654f9d2637e70d286e568bcd41fd3eb746..8d666dedb45307af1ba29c95ed51f96b956d7e73 100644 (file)
@@ -451,7 +451,7 @@ public class Vala.Property : Member, Lockable {
                        }
                }
 
-               if (default_expression != null && !(default_expression.value_type.compatible (property_type))) {
+               if (default_expression != null && !default_expression.error && !(default_expression.value_type.compatible (property_type))) {
                        error = true;
                        Report.error (default_expression.source_reference, "Expected initializer of type `%s' but got `%s'".printf (property_type.to_string (), default_expression.value_type.to_string ()));
                }
index 4d13ac76196243bc47ba7add46adaef5994b3847..cc991eb35910455a8896dca377d20dd20ade2482 100644 (file)
@@ -719,6 +719,7 @@ public class Vala.Struct : TypeSymbol {
                }
 
                if (!external && !external_package && base_type == null && get_fields ().size == 0) {
+                       error = true;
                        Report.error (source_reference, "structs cannot be empty");
                }