From 25a1e54fa24afa50f2de4eaff08c3953cc20cc57 Mon Sep 17 00:00:00 2001 From: Juerg Billeter Date: Wed, 30 Jan 2008 16:38:04 +0000 Subject: [PATCH] report error when using automatic properties in interfaces, fixes bug 2008-01-30 Juerg Billeter * vala/valasemanticanalyzer.vala: report error when using automatic properties in interfaces, fixes bug 513157 svn path=/trunk/; revision=930 --- ChangeLog | 5 +++++ vala/valasemanticanalyzer.vala | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index eae93c1..b8e053c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-01-30 Jürg Billeter + * vala/valasemanticanalyzer.vala: report error when using automatic + properties in interfaces, fixes bug 513157 + +2008-01-30 Jürg Billeter + * vala/valasemanticanalyzer.vala: report error when trying to add instance fields to interfaces, fixes bug 513152 diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index 806f611..11ecc82 100644 --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -637,7 +637,13 @@ public class Vala.SemanticAnalyzer : CodeVisitor { if (!acc.source_reference.file.pkg) { if (acc.body == null && !acc.prop.interface_only && !acc.prop.is_abstract) { /* no accessor body specified, insert default body */ - + + if (acc.prop.parent_symbol is Interface) { + acc.error = true; + Report.error (acc.source_reference, "Automatic properties can't be used in interfaces"); + return; + } + acc.body = new Block (); if (acc.readable) { acc.body.add_statement (new ReturnStatement (new MemberAccess.simple ("_%s".printf (acc.prop.name)), acc.source_reference)); -- 2.7.4