diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-03-12 10:29:46 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-03-17 19:40:19 +0100 |
commit | 2caef4facc1da5c390b94fa11ae52f51d6fc8d6d (patch) | |
tree | 206dee6d05b4450451a494f06aedbbf678937705 /vala/valaclass.vala | |
parent | f4b86c1e2aa0b74f843fc64de919390f6af46952 (diff) | |
download | vala-2caef4facc1da5c390b94fa11ae52f51d6fc8d6d.tar.gz |
vala: Report error for public creation methods of abstract classes
Only report a warning for external creation methods to reduce the initial
fallout.
Fixes https://gitlab.gnome.org/GNOME/vala/issues/766
Diffstat (limited to 'vala/valaclass.vala')
-rw-r--r-- | vala/valaclass.vala | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vala/valaclass.vala b/vala/valaclass.vala index 51e8fbade..933a67c26 100644 --- a/vala/valaclass.vala +++ b/vala/valaclass.vala @@ -296,6 +296,16 @@ public class Vala.Class : ObjectTypeSymbol { m.error = true; return; } + if (is_abstract && cm.access == SymbolAccessibility.PUBLIC) { + //TODO Report an error for external constructors too + if (external_package) { + Report.warning (m.source_reference, "Creation method of abstract class cannot be public."); + } else { + Report.error (m.source_reference, "Creation method of abstract class cannot be public."); + error = true; + return; + } + } } base.add_method (m); |