[vala/staging] vala: Don't ignore qualified parent when inferring type of enum member
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] vala: Don't ignore qualified parent when inferring type of enum member
- Date: Thu, 28 Feb 2019 19:45:28 +0000 (UTC)
commit 69952c8522224ca5257bf60b134ab0ca298e552b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Feb 28 20:35:08 2019 +0100
vala: Don't ignore qualified parent when inferring type of enum member
https://bugzilla.gnome.org/show_bug.cgi?id=666035
tests/Makefile.am | 2 ++
tests/enums/bug666035-1.test | 5 +++++
tests/enums/bug666035-2.test | 10 ++++++++++
vala/valamemberaccess.vala | 2 +-
4 files changed, 18 insertions(+), 1 deletion(-)
---
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..fd1451e78
--- /dev/null
+++ b/tests/enums/bug666035-2.test
@@ -0,0 +1,10 @@
+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) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]