checker: fixed type inference over a generic function

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
pull/13824/head
Vincenzo Palazzo 2022-03-31 20:32:53 +02:00
parent 8d63db9731
commit ae4bb3aa88
No known key found for this signature in database
GPG Key ID: 8B6DC2B870B80D5F
2 changed files with 1 additions and 2 deletions

View File

@ -535,7 +535,7 @@ pub fn (mut c Checker) infer_fn_generic_types(func ast.Fn, mut node ast.CallExpr
for i, param in func.params {
mut to_set := ast.void_type
// resolve generic struct receiver
if i == 0 && node.is_method && param.typ.has_flag(.generic) {
if node.is_method && param.typ.has_flag(.generic) {
sym := c.table.sym(node.receiver_type)
match sym.info {
ast.Struct, ast.Interface, ast.SumType {

View File

@ -1,7 +1,6 @@
import datatypes
struct KeyVal<T> {
mut:
key string
val T
}