]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Check base types of classes, interfaces, and structs, patch by Andreas
authorJürg Billeter <j@bitron.ch>
Tue, 6 Jan 2009 23:16:07 +0000 (23:16 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Tue, 6 Jan 2009 23:16:07 +0000 (23:16 +0000)
2009-01-07  Jürg Billeter  <j@bitron.ch>

* vala/valaclass.vala:
* vala/valainterface.vala:
* vala/valastruct.vala:

Check base types of classes, interfaces, and structs,
patch by Andreas Brauchli, fixes bug 566592

svn path=/trunk/; revision=2281

ChangeLog
vala/valaclass.vala
vala/valainterface.vala
vala/valastruct.vala

index 93e297b6ff0ff56dbf2e85dd12048861db913cbd..853172adb6540932c7f2b1d128ea6c6da7945917 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-01-07  Jürg Billeter  <j@bitron.ch>
+
+       * vala/valaclass.vala:
+       * vala/valainterface.vala:
+       * vala/valastruct.vala:
+
+       Check base types of classes, interfaces, and structs,
+       patch by Andreas Brauchli, fixes bug 566592
+
 2009-01-07  Jürg Billeter  <j@bitron.ch>
 
        * gobject/valaccodememberaccessmodule.vala:
index 3c889a4be104ca37af9c3a3b7dc9c443a020c22c..a1b749699589407d01bea86a9374f2d94a604cd0 100644 (file)
@@ -866,6 +866,12 @@ public class Vala.Class : ObjectTypeSymbol {
                                return false;
                        }
 
+                       if (!(base_type_reference is ObjectType)) {
+                               error = true;
+                               Report.error (source_reference, "base type `%s` of class `%s` is not an object type".printf (base_type_reference.to_string (), get_full_name ()));
+                               return false;
+                       }
+
                        // check whether base type is at least as accessible as the class
                        if (!analyzer.is_type_accessible (this, base_type_reference)) {
                                error = true;
index 9d7824a2ef63adb94d6c74c23b4c367e0cfa1249..1b5be99a0dbb5fc3aa8a13999b58bb61749397bd 100644 (file)
@@ -545,6 +545,13 @@ public class Vala.Interface : ObjectTypeSymbol {
                                error = true;
                                continue;
                        }
+
+                       if (!(class_or_interface is ObjectTypeSymbol)) {
+                               error = true;
+                               Report.error (source_reference, "Prerequisite `%s` of interface `%s` is not a class or interface".printf (get_full_name (), class_or_interface.to_string ()));
+                               return false;
+                       }
+
                        /* interfaces are not allowed to have multiple instantiable prerequisites */
                        if (class_or_interface is Class) {
                                if (prereq_class != null) {
index 5c07de00eb58c73f9bd8fedf7264ea60a045909a..62bb24913f019b355a5d54077a2b0ede85ff5d65 100644 (file)
@@ -679,6 +679,12 @@ public class Vala.Struct : TypeSymbol {
 
                foreach (DataType type in base_types) {
                        type.check (analyzer);
+
+                       if (!(type is StructValueType)) {
+                               error = true;
+                               Report.error (source_reference, "The base type `%s` of value type `%s` is not a struct".printf (type.data_type.to_string (), get_full_name ()));
+                               return false;
+                       }
                }
 
                foreach (TypeParameter p in type_parameters) {