[vala/staging: 1/12] SemanticAnalyser.get_actual_type() should never return null



commit 2741f1ad5130977a0c8b0b517476bfcd9eec6f0d
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Dec 8 23:21:05 2017 +0100

    SemanticAnalyser.get_actual_type() should never return null
    
    So better return an InvalidType in case of error.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=587905

 vala/valasemanticanalyzer.vala |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index a0a7e3d..f4d86d0 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -815,7 +815,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                return null;
        }
 
-       public static DataType? get_actual_type (DataType? derived_instance_type, List<DataType>? 
method_type_arguments, GenericType generic_type, CodeNode node_reference) {
+       public static DataType get_actual_type (DataType? derived_instance_type, List<DataType>? 
method_type_arguments, GenericType generic_type, CodeNode node_reference) {
                DataType actual_type = null;
                if (generic_type.type_parameter.parent_symbol is TypeSymbol) {
                        if (derived_instance_type != null) {
@@ -825,7 +825,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                                if (instance_type == null) {
                                        Report.error (node_reference.source_reference, "The type-parameter 
`%s' must be defined on enclosing type".printf (generic_type.to_string ()));
                                        node_reference.error = true;
-                                       return null;
+                                       return new InvalidType ();
                                }
 
                                int param_index;
@@ -837,7 +837,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                                if (param_index == -1) {
                                        Report.error (node_reference.source_reference, "internal error: 
unknown type parameter %s".printf (generic_type.type_parameter.name));
                                        node_reference.error = true;
-                                       return null;
+                                       return new InvalidType ();
                                }
 
                                if (param_index < instance_type.get_type_arguments ().size) {
@@ -852,7 +852,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        if (param_index == -1) {
                                Report.error (node_reference.source_reference, "internal error: unknown type 
parameter %s".printf (generic_type.type_parameter.name));
                                node_reference.error = true;
-                               return null;
+                               return new InvalidType ();
                        }
 
                        if (method_type_arguments != null) {


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