From 123a29b5838fb769f28e71f510f707f8d9bca7dc Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Mon, 19 Jun 2023 10:49:43 +0200 Subject: [PATCH] vala: Report an error when trying to chain up to inaccessible private ctor Fixes https://gitlab.gnome.org/GNOME/vala/issues/1445 --- vala/valamethodcall.vala | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 2.47.2