From: Rico Tzschichholz Date: Mon, 19 Jun 2023 08:49:43 +0000 (+0200) Subject: vala: Report an error when trying to chain up to inaccessible private ctor X-Git-Tag: 0.56.9~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e4dd771f138ad0c309d82885418b54d92f59136e;p=thirdparty%2Fvala.git vala: Report an error when trying to chain up to inaccessible private ctor Fixes https://gitlab.gnome.org/GNOME/vala/issues/1445 --- diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala index 7333891b4..b59ac36a3 100644 --- a/vala/valamethodcall.vala +++ b/vala/valamethodcall.vala @@ -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