]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Report an error when trying to chain up to inaccessible private ctor
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 19 Jun 2023 08:49:43 +0000 (10:49 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 19 Jun 2023 08:49:43 +0000 (10:49 +0200)
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1445

vala/valamethodcall.vala

index 3f0c0d11814c4a923e87fef42046a0248a7edf2b..8dd33750efb7a9366349b85bac1051df1b4b7093 100644 (file)
@@ -300,6 +300,12 @@ public class Vala.MethodCall : Expression, CallableExpression {
                                call.value_type = new ObjectType (context.analyzer.object_type, source_reference);
                                mtype = call.value_type;
                        }
+
+                       if (base_cm != null && source_reference.file != base_cm.source_reference.file && base_cm.access == SymbolAccessibility.PRIVATE) {
+                               error = true;
+                               Report.error (source_reference, "chain up to private `%s' not possible", base_cm.get_full_name ());
+                               return false;
+                       }
                }
 
                // check for struct construction