[vala] Check type of field initializers
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [vala] Check type of field initializers
- Date: Fri, 10 Jul 2009 11:44:41 +0000 (UTC)
commit d84ea1c3e772270555d3dcaf436984b63f02318a
Author: Jürg Billeter <j bitron ch>
Date: Fri Jul 10 12:38:50 2009 +0100
Check type of field initializers
vala/valafield.vala | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/vala/valafield.vala b/vala/valafield.vala
index c754a33..420f7f9 100644
--- a/vala/valafield.vala
+++ b/vala/valafield.vala
@@ -313,6 +313,12 @@ public class Vala.Field : Member, Lockable {
initializer.target_type = field_type;
initializer.check (analyzer);
+
+ if (!initializer.value_type.compatible (field_type)) {
+ error = true;
+ Report.error (source_reference, "Cannot convert from `%s' to `%s'".printf (initializer.value_type.to_string (), field_type.to_string ()));
+ return false;
+ }
}
if (binding == MemberBinding.INSTANCE && parent_symbol is Interface) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]