checker: fix generic os.fn call (script) without mod prefix. fixes #7073

pull/7091/head
joe-conigliaro 2020-12-02 21:40:44 +11:00
parent ca7692c839
commit cd46eb42d7
No known key found for this signature in database
GPG Key ID: C12F7136C08206F1
1 changed files with 3 additions and 0 deletions

View File

@ -1433,6 +1433,9 @@ pub fn (mut c Checker) call_fn(mut call_expr ast.CallExpr) table.Type {
if c.pref.is_script && !found {
os_name := 'os.$fn_name'
if f1 := c.table.find_fn(os_name) {
if f1.is_generic && call_expr.generic_type != table.void_type {
c.table.fn_gen_types[os_name] = c.table.fn_gen_types['${call_expr.mod}.$call_expr.name']
}
call_expr.name = os_name
found = true
f = f1