1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: fixes issue #3074 - can't call a generic function twice with the same data type

This commit is contained in:
joe-conigliaro 2019-12-14 17:54:34 +11:00 committed by GitHub
parent 29fc3fc82f
commit cb9e9286ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1469,6 +1469,7 @@ fn (p mut Parser) dispatch_generic_fn_instance(f mut Fn, ti &TypeInst) {
}
if !new_inst {
rename_generic_fn_instance(mut f, ti)
replace_generic_type_params(mut f, ti)
_ = p.table.find_fn(f.name) or {
p.error('function instance `$f.name` not found')
return
@ -1480,7 +1481,6 @@ fn (p mut Parser) dispatch_generic_fn_instance(f mut Fn, ti &TypeInst) {
p.table.register_fn(f)
rename_generic_fn_instance(mut f, ti)
replace_generic_type_params(mut f, ti)
// TODO: save dispatch info when update to incremental parsing
f.dispatch_of = *ti
// TODO: Handle case where type not defined yet, see above
// if f.typ in f.type_pars { f.typ = '_ANYTYPE_' }