mirror of
https://github.com/vlang/v.git
synced 2025-08-04 02:07:28 -04:00
This commit is contained in:
parent
9238dd6b31
commit
ae9456adc6
@ -2087,7 +2087,7 @@ pub fn (mut t Table) unwrap_generic_type(typ Type, generic_names []string, concr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mut info := ts.info
|
mut info := ts.info
|
||||||
info.is_generic = false
|
info.is_generic = final_concrete_types.any(it.has_flag(.generic))
|
||||||
info.concrete_types = final_concrete_types
|
info.concrete_types = final_concrete_types
|
||||||
info.parent_type = typ.set_flag(.generic)
|
info.parent_type = typ.set_flag(.generic)
|
||||||
info.fields = fields
|
info.fields = fields
|
||||||
|
19
vlib/v/tests/interface_generic_implements_test.v
Normal file
19
vlib/v/tests/interface_generic_implements_test.v
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
interface Foo[T] {
|
||||||
|
val T
|
||||||
|
foo() T
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Bar[T] implements Foo[T] {
|
||||||
|
val T
|
||||||
|
}
|
||||||
|
|
||||||
|
fn (b Bar[T]) foo() T {
|
||||||
|
return b.val
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_main() {
|
||||||
|
b := Bar{
|
||||||
|
val: 0
|
||||||
|
}
|
||||||
|
assert b.foo() == 0
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user