Report error when declaring a compact class implementing an interface,
authorJuerg Billeter <j@bitron.ch>
Wed, 28 May 2008 16:25:28 +0000 (16:25 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Wed, 28 May 2008 16:25:28 +0000 (16:25 +0000)
2008-05-28  Juerg Billeter  <j@bitron.ch>

* vala/valasemanticanalyzer.vala:

Report error when declaring a compact class implementing an
interface, patch by Phil Housley

svn path=/trunk/; revision=1463

ChangeLog
vala/valasemanticanalyzer.vala

index 7301ba6..ef1c9fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-05-28  Jürg Billeter  <j@bitron.ch>
 
+       * vala/valasemanticanalyzer.vala:
+
+       Report error when declaring a compact class implementing an
+       interface, patch by Phil Housley
+
+2008-05-28  Jürg Billeter  <j@bitron.ch>
+
        * vapi/glib-2.0.vapi: fix GTypeModule binding
 
 2008-05-28  Jürg Billeter  <j@bitron.ch>
index 7fcadbd..3ffda90 100644 (file)
@@ -135,6 +135,16 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
 
                cl.accept_children (this);
 
+               /* compact classes cannot implement interfaces */
+               if (cl.is_compact) {
+                       foreach (DataType base_type in cl.get_base_types ()) {
+                               if (base_type.data_type is Interface) {
+                                       cl.error = true;
+                                       Report.error (cl.source_reference, "compact classes `%s` may not implement interfaces".printf (cl.get_full_name ()));
+                               }
+                       }
+               }
+
                /* gather all prerequisites */
                Gee.List<TypeSymbol> prerequisites = new ArrayList<TypeSymbol> ();
                foreach (DataType base_type in cl.get_base_types ()) {