This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch eolian/improvements
in repository efl.

View the commit online.

commit b2c949363ca89e9d9d2ab3d08d4f7e14cc35df34
Author: Cedric BAIL <[email protected]>
AuthorDate: Tue Aug 18 09:18:17 2026 -0600

    eolian: check that stable classes do not inherit beta ones
    
    Validation already refuses a non-beta class with a beta parent, and refuses
    beta types, classes and errors in stable signatures, but it never looked at
    the rest of the inheritance. A stable class listing a beta interface in its
    implements list therefore passed silently, and produced no C level symptom
    either: the generated header of the stable class declares only its own stable
    members, so nothing ever refers to the beta interface. That is how
    Efl.Ui.Collection and Efl.Ui.Collection_View came to implement beta
    Efl.Ui.Item_Clickable unnoticed.
    
    Check the extends, composite and requires lists the same way the parent is
    checked. The tree has 46 such pairs across 27 classes today, Efl.Ui.Widget and
    Efl.Ui.Win among them, so the check only reports when
    EOLIAN_CLASS_BETA_INHERIT_WARN is set, following the existing
    EOLIAN_CLASS_UNIMPLEMENTED_BETA_WARN pattern. It is turned on once those are
    resolved.
    
    Co-Authored-By: Claude Opus 5 <[email protected]>
---
 src/lib/eolian/database_validate.c           | 38 +++++++++++++++++++++++++++-
 src/tests/eolian/data/beta_iface.eo          |  6 +++++
 src/tests/eolian/data/beta_inherit_beta.eo   |  7 +++++
 src/tests/eolian/data/beta_inherit_stable.eo |  8 ++++++
 src/tests/eolian/eolian_parsing.c            | 30 ++++++++++++++++++++++
 5 files changed, 88 insertions(+), 1 deletion(-)

diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 813595db70..1fc652faf3 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -15,6 +15,7 @@ typedef struct _Validate_State
    Eina_Bool stable;
    Eina_Bool in_tree;
    Eina_Bool unimplemented_beta;
+   Eina_Bool beta_inherit;
    const char *since_ver;
 } Validate_State;
 
@@ -1240,6 +1241,35 @@ _db_swap_inherit(Eolian_Class *cl, Eina_Bool succ, Eina_Stringshare *in_cl,
 
 static void _add_implicit_composite(Eolian_Class *icl, Eina_Hash *ch, Eina_Bool try_tree);
 
+/* a stable class that pulls a beta interface, mixin or class into its
+ * inheritance is a lie: nothing it inherits from is reachable without
+ * EFL_BETA_API_SUPPORT, while its own generated header claims to be stable.
+ * The parent case is a plain error (see _validate_class); the rest of the
+ * inheritance is only reported when EOLIAN_CLASS_BETA_INHERIT_WARN is set,
+ * because the tree still has offenders that are being worked through class
+ * by class.
+ */
+static void
+_check_beta_inherit(Validate_State *vals, Eolian_Class *cl,
+                    const Eolian_Class *icl, const char *verb)
+{
+   if (!vals->beta_inherit || cl->base.is_beta || !icl->base.is_beta)
+     return;
+
+   const char *kind = "class";
+   switch (icl->type)
+     {
+      case EOLIAN_CLASS_INTERFACE: kind = "interface"; break;
+      case EOLIAN_CLASS_MIXIN: kind = "mixin"; break;
+      case EOLIAN_CLASS_ABSTRACT: kind = "abstract class"; break;
+      default: break;
+     }
+
+   _eo_parser_log(&cl->base, "non-beta class cannot %s beta %s '%s'",
+                  verb, kind, icl->base.name);
+   vals->warned = EINA_TRUE;
+}
+
 /* this is so we can inherit composite lists into regular classes
  * it doesn't need to be recursive since the parent/extension already
  * has its composite stuff filled in from before
@@ -1312,6 +1342,7 @@ _db_fill_inherits(Validate_State *vals, Eolian_Class *cl, Eina_Hash *fhash,
         if (!succ)
           continue;
         cl->extends = eina_list_append(cl->extends, out_cl);
+        _check_beta_inherit(vals, cl, out_cl, "implement");
         succ = _db_fill_inherits(vals, out_cl, fhash, errh);
      }
 
@@ -1333,7 +1364,10 @@ _db_fill_inherits(Validate_State *vals, Eolian_Class *cl, Eina_Hash *fhash,
              if (!succ)
                continue;
              if (!eina_list_data_find(cl->requires, out_cl))
-               cl->requires = eina_list_append(cl->requires, out_cl);
+               {
+                  _check_beta_inherit(vals, cl, out_cl, "require");
+                  cl->requires = eina_list_append(cl->requires, out_cl);
+               }
           }
      }
 
@@ -1351,6 +1385,7 @@ _db_fill_inherits(Validate_State *vals, Eolian_Class *cl, Eina_Hash *fhash,
         if (!succ)
           continue;
         cl->composite = eina_list_append(cl->composite, out_cl);
+        _check_beta_inherit(vals, cl, out_cl, "composite");
         succ = _db_fill_inherits(vals, out_cl, fhash, errh);
         ++ncomp;
         /* for each thing that is composited, we need to add the entire
@@ -1697,6 +1732,7 @@ database_validate(const Eolian_Unit *src)
       EINA_TRUE,
       !!getenv("EFL_RUN_IN_TREE"),
       !!getenv("EOLIAN_CLASS_UNIMPLEMENTED_BETA_WARN"),
+      !!getenv("EOLIAN_CLASS_BETA_INHERIT_WARN"),
    };
 
    /* do an initial pass to refill inherits */
diff --git a/src/tests/eolian/data/beta_iface.eo b/src/tests/eolian/data/beta_iface.eo
new file mode 100644
index 0000000000..1d5248f8f5
--- /dev/null
+++ b/src/tests/eolian/data/beta_iface.eo
@@ -0,0 +1,6 @@
+interface @beta Beta_Iface {
+    methods {
+        foo {
+        }
+    }
+}
diff --git a/src/tests/eolian/data/beta_inherit_beta.eo b/src/tests/eolian/data/beta_inherit_beta.eo
new file mode 100644
index 0000000000..911b5c3947
--- /dev/null
+++ b/src/tests/eolian/data/beta_inherit_beta.eo
@@ -0,0 +1,7 @@
+import beta_iface;
+
+class @beta Beta_Inherit_Beta implements Beta_Iface {
+    implements {
+        Beta_Iface.foo;
+    }
+}
diff --git a/src/tests/eolian/data/beta_inherit_stable.eo b/src/tests/eolian/data/beta_inherit_stable.eo
new file mode 100644
index 0000000000..663881bae9
--- /dev/null
+++ b/src/tests/eolian/data/beta_inherit_stable.eo
@@ -0,0 +1,8 @@
+import beta_iface;
+
+class Beta_Inherit_Stable implements Beta_Iface {
+    [[Docs for class Beta_Inherit_Stable. @since 1.66]]
+    implements {
+        Beta_Iface.foo;
+    }
+}
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index 78fa2bc699..723000503b 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -1619,6 +1619,35 @@ EFL_START_TEST(eolian_class_unimpl_inherited_composite)
 }
 EFL_END_TEST
 
+EFL_START_TEST(eolian_class_beta_inherit)
+{
+   Eolian_State *eos = eolian_state_new();
+
+   fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
+
+   /* off by default: the tree still has stable classes implementing beta
+    * interfaces, so this must not break anyone's build yet
+    */
+   fail_if(!eolian_state_file_parse(eos, "beta_inherit_stable.eo"));
+
+   eolian_state_free(eos);
+   eos = eolian_state_new();
+   fail_if(!eolian_state_directory_add(eos, TESTS_SRC_DIR"/data"));
+
+   setenv("EOLIAN_CLASS_BETA_INHERIT_WARN", "1", 1);
+
+   /* a beta class may implement a beta interface */
+   fail_if(!eolian_state_file_parse(eos, "beta_inherit_beta.eo"));
+
+   /* a stable one may not */
+   fail_if(!!eolian_state_file_parse(eos, "beta_inherit_stable.eo"));
+
+   unsetenv("EOLIAN_CLASS_BETA_INHERIT_WARN");
+
+   eolian_state_free(eos);
+}
+EFL_END_TEST
+
 EFL_START_TEST(eolian_version)
 {
    Eolian_State *eos = eolian_state_new();
@@ -1662,5 +1691,6 @@ void eolian_parsing_test(TCase *tc)
    tcase_add_test(tc, eolian_class_requires_classes);
    tcase_add_test(tc, eolian_class_unimpl);
    tcase_add_test(tc, eolian_class_unimpl_inherited_composite);
+   tcase_add_test(tc, eolian_class_beta_inherit);
    tcase_add_test(tc, eolian_version);
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to