Commit 6b656b07 authored by Rico Tzschichholz's avatar Rico Tzschichholz

vala: Report error for missing type-parameter on enclosing type

Make a qualified guess for the cause of the problem instead of triggering
an assertion.

https://bugzilla.gnome.org/show_bug.cgi?id=587905
parent be9e795b
......@@ -187,6 +187,7 @@ TESTS = \
objects/test-029.vala \
objects/test-034.vala \
objects/bug566909.vala \
objects/bug587905.test \
objects/bug588203.vala \
objects/bug589928.vala \
objects/bug593260.vala \
......
Invalid Code
class Generic<T> {
class Nested {
public T member;
}
}
void main () {
}
......@@ -822,7 +822,11 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
// trace type arguments back to the datatype where the method has been declared
var instance_type = get_instance_base_type_for_member (derived_instance_type, (TypeSymbol) generic_type.type_parameter.parent_symbol, node_reference);
assert (instance_type != null);
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;
}
int param_index;
if (instance_type is DelegateType) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment