From 8f629e66185a5bf8958a0592f32911e72aa94d26 Mon Sep 17 00:00:00 2001 From: Juerg Billeter Date: Fri, 18 Apr 2008 21:49:39 +0000 Subject: [PATCH] check accessiblity of base types of classes and interfaces, fixes bug 2008-04-18 Juerg Billeter * vala/valasemanticanalyzer.vala: check accessiblity of base types of classes and interfaces, fixes bug 514262 svn path=/trunk/; revision=1257 --- ChangeLog | 5 +++++ vala/valasemanticanalyzer.vala | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index ec3f6fb..61926a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-04-18 Jürg Billeter + * vala/valasemanticanalyzer.vala: check accessiblity of base types + of classes and interfaces, fixes bug 514262 + +2008-04-18 Jürg Billeter + * vala/valaparser.vala: don't report secondary syntax errors, fixes bug 511896 diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index e75effc..181fc34 100644 --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -132,6 +132,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { current_class = cl; foreach (DataType base_type_reference in cl.get_base_types ()) { + // check whether base type is at least as accessible as the class + if (!is_type_accessible (cl, base_type_reference)) { + cl.error = true; + Report.error (cl.source_reference, "base type `%s` is less accessible than class `%s`".printf (base_type_reference.to_string (), cl.get_full_name ())); + return; + } + current_source_file.add_type_dependency (base_type_reference, SourceFileDependencyType.HEADER_FULL); } @@ -263,6 +270,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { current_symbol = iface; foreach (DataType prerequisite_reference in iface.get_prerequisites ()) { + // check whether prerequisite is at least as accessible as the interface + if (!is_type_accessible (iface, prerequisite_reference)) { + iface.error = true; + Report.error (iface.source_reference, "prerequisite `%s` is less accessible than interface `%s`".printf (prerequisite_reference.to_string (), iface.get_full_name ())); + return; + } + current_source_file.add_type_dependency (prerequisite_reference, SourceFileDependencyType.HEADER_FULL); } -- 2.7.4