table: fix check for fn with no args

pull/4716/head
joe-conigliaro 2020-05-05 02:44:10 +10:00
parent 2bb995274e
commit c9798d3918
No known key found for this signature in database
GPG Key ID: C12F7136C08206F1
1 changed files with 2 additions and 4 deletions

View File

@ -535,15 +535,13 @@ pub fn (t &Table) check(got, expected Type) bool {
got_info := got_type_sym.info as FnType
exp_info := exp_type_sym.info as FnType
if got_info.func.args.len == exp_info.func.args.len {
mut matching := false
for i, got_arg in got_info.func.args {
exp_arg := exp_info.func.args[i]
matching = t.check(got_arg.typ, exp_arg.typ)
if !matching {
if !t.check(got_arg.typ, exp_arg.typ) {
return false
}
}
return matching
return true
}
}
return false