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-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=123a29b5838fb769f28e71f510f707f8d9bca7dc;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 3f0c0d118..8dd33750e 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