Commit e32e2f08 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

Check base types of classes, interfaces, and structs, patch by Andreas

2009-01-07  Jürg Billeter  <j@bitron.ch>

	* vala/valaclass.vala:
	* vala/valainterface.vala:
	* vala/valastruct.vala:

	Check base types of classes, interfaces, and structs,
	patch by Andreas Brauchli, fixes bug 566592

svn path=/trunk/; revision=2281
parent 578f9623
2009-01-07 Jürg Billeter <j@bitron.ch>
* vala/valaclass.vala:
* vala/valainterface.vala:
* vala/valastruct.vala:
Check base types of classes, interfaces, and structs,
patch by Andreas Brauchli, fixes bug 566592
2009-01-07 Jürg Billeter <j@bitron.ch>
* gobject/valaccodememberaccessmodule.vala:
......
......@@ -866,6 +866,12 @@ public class Vala.Class : ObjectTypeSymbol {
return false;
}
if (!(base_type_reference is ObjectType)) {
error = true;
Report.error (source_reference, "base type `%s` of class `%s` is not an object type".printf (base_type_reference.to_string (), get_full_name ()));
return false;
}
// check whether base type is at least as accessible as the class
if (!analyzer.is_type_accessible (this, base_type_reference)) {
error = true;
......
......@@ -545,6 +545,13 @@ public class Vala.Interface : ObjectTypeSymbol {
error = true;
continue;
}
if (!(class_or_interface is ObjectTypeSymbol)) {
error = true;
Report.error (source_reference, "Prerequisite `%s` of interface `%s` is not a class or interface".printf (get_full_name (), class_or_interface.to_string ()));
return false;
}
/* interfaces are not allowed to have multiple instantiable prerequisites */
if (class_or_interface is Class) {
if (prereq_class != null) {
......
......@@ -679,6 +679,12 @@ public class Vala.Struct : TypeSymbol {
foreach (DataType type in base_types) {
type.check (analyzer);
if (!(type is StructValueType)) {
error = true;
Report.error (source_reference, "The base type `%s` of value type `%s` is not a struct".printf (type.data_type.to_string (), get_full_name ()));
return false;
}
}
foreach (TypeParameter p in type_parameters) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment