[vala/staging: 3/3] vala: Fix MemberAccess.is_non_null() for EnumValue constants
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 3/3] vala: Fix MemberAccess.is_non_null() for EnumValue constants
- Date: Tue, 14 Mar 2017 21:41:52 +0000 (UTC)
commit b57a9f8b1c21ec7cf685ead4a0aee093cd2c3357
Author: Ole André Vadla Ravnås <oleavr gmail com>
Date: Tue Mar 14 20:44:45 2017 +0100
vala: Fix MemberAccess.is_non_null() for EnumValue constants
This is because an EnumValue object does not have a type reference.
https://bugzilla.gnome.org/show_bug.cgi?id=780050
tests/Makefile.am | 1 +
tests/enums/bug780050.vala | 10 ++++++++++
vala/valamemberaccess.vala | 2 +-
3 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 426570c..add13c5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -112,6 +112,7 @@ TESTS = \
enums/flags.vala \
enums/bug673879.vala \
enums/bug763831.vala \
+ enums/bug780050.vala \
structs/structs.vala \
structs/gvalue.vala \
structs/bug530605.vala \
diff --git a/tests/enums/bug780050.vala b/tests/enums/bug780050.vala
new file mode 100644
index 0000000..b69f7c0
--- /dev/null
+++ b/tests/enums/bug780050.vala
@@ -0,0 +1,10 @@
+enum Bar {
+ FOO
+}
+
+namespace Foo {
+ Bar bar = Bar.FOO;
+}
+
+void main () {
+}
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 23ca8d6..c00f5fc 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -187,7 +187,7 @@ public class Vala.MemberAccess : Expression {
public override bool is_non_null () {
var c = symbol_reference as Constant;
if (c != null) {
- return !c.type_reference.nullable;
+ return (c is EnumValue || !c.type_reference.nullable);
} else {
return false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]