summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2019-02-28 20:35:08 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2019-03-01 07:27:28 +0100
commit8629327cac8571bb71d19ec1ce683e24781beb3e (patch)
treec240f2fd69c349f9fa501c555d6d9f72774d17b0
parentfcc4a9235540c83f573086d573aae2ba03f63360 (diff)
downloadvala-8629327cac8571bb71d19ec1ce683e24781beb3e.tar.gz
vala: Don't ignore qualified parent when inferring type of enum member
Regression of 33c91a04f758c89f0402994a6df894e6c2032def https://bugzilla.gnome.org/show_bug.cgi?id=666035
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/enums/bug666035-1.test5
-rw-r--r--tests/enums/bug666035-2.test9
-rw-r--r--vala/valamemberaccess.vala2
4 files changed, 17 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7f10b1606..89c878d47 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -193,6 +193,8 @@ TESTS = \
enums/flags.vala \
enums/no_gtype_to_string.vala \
enums/bug666035.vala \
+ enums/bug666035-1.test \
+ enums/bug666035-2.test \
enums/bug673879.vala \
enums/bug763831.vala \
enums/bug780050.vala \
diff --git a/tests/enums/bug666035-1.test b/tests/enums/bug666035-1.test
new file mode 100644
index 000000000..487254eed
--- /dev/null
+++ b/tests/enums/bug666035-1.test
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+ GLib.BindingFlags foo = GLib.Binding.SYNC_CREATE;
+}
diff --git a/tests/enums/bug666035-2.test b/tests/enums/bug666035-2.test
new file mode 100644
index 000000000..fb4c7832c
--- /dev/null
+++ b/tests/enums/bug666035-2.test
@@ -0,0 +1,9 @@
+Invalid Code
+
+void main () {
+ GLib.BindingFlags foo = 0;
+
+ switch (foo) {
+ case GLib.Binding.SYNC_CREATE: break;
+ }
+}
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index e148fa276..8fd60db56 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -450,7 +450,7 @@ public class Vala.MemberAccess : Expression {
}
// enum-type inference
- if (symbol_reference == null && target_type != null && target_type.data_type is Enum) {
+ if (inner == null && symbol_reference == null && target_type != null && target_type.data_type is Enum) {
var enum_type = (Enum) target_type.data_type;
foreach (var val in enum_type.get_values ()) {
if (member_name == val.name) {