table: fix error of generics interface declaration (#10883)
parent
e38b0d7e9f
commit
ec87f4ee99
|
@ -1121,6 +1121,12 @@ pub fn (mut t Table) does_type_implement_interface(typ Type, inter_typ Type) boo
|
||||||
if typ_sym.language != .v {
|
if typ_sym.language != .v {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
// generic struct don't generate cast interface fn
|
||||||
|
if typ_sym.info is Struct {
|
||||||
|
if typ_sym.info.is_generic {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
mut inter_sym := t.get_type_symbol(inter_typ)
|
mut inter_sym := t.get_type_symbol(inter_typ)
|
||||||
if typ_sym.kind == .interface_ && inter_sym.kind == .interface_ {
|
if typ_sym.kind == .interface_ && inter_sym.kind == .interface_ {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
interface Depends {
|
||||||
|
depends() []Depends
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Signal<T> {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn (x Signal<T>) depends() []Depends {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Add<T> {
|
||||||
|
a Signal<T>
|
||||||
|
b Signal<T>
|
||||||
|
}
|
||||||
|
|
||||||
|
fn (a Add<T>) depends() []Depends {
|
||||||
|
return [a.a, a.b]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_generics_interface_decl() {
|
||||||
|
assert true
|
||||||
|
}
|
Loading…
Reference in New Issue