parent
7a6491b9b0
commit
093cab6f56
|
@ -856,10 +856,13 @@ pub fn (mut c Checker) generic_insts_to_concrete() {
|
||||||
}
|
}
|
||||||
typ.is_public = true
|
typ.is_public = true
|
||||||
typ.kind = parent.kind
|
typ.kind = parent.kind
|
||||||
}
|
|
||||||
parent_sym := c.table.get_type_symbol(parent_info.parent_type)
|
parent_sym := c.table.get_type_symbol(parent_info.parent_type)
|
||||||
for method in parent_sym.methods {
|
for method in parent_sym.methods {
|
||||||
c.table.register_fn_concrete_types(method.name, info.concrete_types)
|
c.table.register_fn_concrete_types(method.name, info.concrete_types)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
util.verror('generic error', 'the number of generic types of struct `$parent.name` is inconsistent with the concrete types')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast.Interface {
|
ast.Interface {
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
generic error: the number of generic types of struct `main.Example` is inconsistent with the concrete types
|
|
@ -0,0 +1,11 @@
|
||||||
|
struct Example<T, V> {
|
||||||
|
key T
|
||||||
|
value V
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
example := Example<string>{
|
||||||
|
key: 'key'
|
||||||
|
value: 'value'
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue