]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Don't ignore qualified parent when inferring type of enum member
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 28 Feb 2019 19:35:08 +0000 (20:35 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Fri, 1 Mar 2019 06:27:28 +0000 (07:27 +0100)
Regression of 33c91a04f758c89f0402994a6df894e6c2032def

https://bugzilla.gnome.org/show_bug.cgi?id=666035

tests/Makefile.am
tests/enums/bug666035-1.test [new file with mode: 0644]
tests/enums/bug666035-2.test [new file with mode: 0644]
vala/valamemberaccess.vala

index 7f10b16065163c6b576c2b3e509e8c217066ce92..89c878d47ab926848124233ffb3b5ce856f88f53 100644 (file)
@@ -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 (file)
index 0000000..487254e
--- /dev/null
@@ -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 (file)
index 0000000..fb4c783
--- /dev/null
@@ -0,0 +1,9 @@
+Invalid Code
+
+void main () {
+       GLib.BindingFlags foo = 0;
+
+       switch (foo) {
+               case GLib.Binding.SYNC_CREATE: break;
+       }
+}
index e148fa27691f0e02e7e3e54d37203f7b6dbce551..8fd60db56c140d658d019da87f36711beeda7610 100644 (file)
@@ -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) {