[vala/0.48] vala: Set value_type of undefined member-access to avoid further criticals



commit 37da20019dc25b90a020ade1b0c983b5e1073305
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat May 9 08:17:47 2020 +0200

    vala: Set value_type of undefined member-access to avoid further criticals

 tests/Makefile.am                           | 1 +
 tests/semantic/member-access-undefined.test | 8 ++++++++
 vala/valamemberaccess.vala                  | 1 +
 3 files changed, 10 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 09f805edf..29dae348c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -828,6 +828,7 @@ TESTS = \
        semantic/member-access-async-callback-invalid.test \
        semantic/member-access-capture-out.test \
        semantic/member-access-protected-invalid.test \
+       semantic/member-access-undefined.test \
        semantic/method-abstract.test \
        semantic/method-abstract-body.test \
        semantic/method-async-ref-parameter.test \
diff --git a/tests/semantic/member-access-undefined.test b/tests/semantic/member-access-undefined.test
new file mode 100644
index 000000000..905269518
--- /dev/null
+++ b/tests/semantic/member-access-undefined.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo<T> (T actual) {
+}
+
+void main () {
+       foo (undefined);
+}
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index 2c0355e1d..1bb805026 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -510,6 +510,7 @@ public class Vala.MemberAccess : Expression {
                        }
 
                        Report.error (source_reference, "The name `%s' does not exist in the context of 
`%s'%s".printf (member_name, base_type_name, base_type_package));
+                       value_type = new InvalidType ();
                        return false;
                } else if (symbol_reference.error) {
                        //ignore previous error


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]