mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
This commit is contained in:
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
|
11
vlib/v/checker/tests/generics_struct_type_mismatch_err.vv
Normal file
11
vlib/v/checker/tests/generics_struct_type_mismatch_err.vv
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
struct Example<T, V> {
|
||||||
|
key T
|
||||||
|
value V
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
example := Example<string>{
|
||||||
|
key: 'key'
|
||||||
|
value: 'value'
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user