checker: fix a type check that caused a C error #6238 (#6358)

pull/6359/head
Vasilis Katsifolis 2020-09-13 16:19:53 +03:00 committed by GitHub
parent 168daebccf
commit 43942057a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -1383,9 +1383,12 @@ pub fn (mut c Checker) call_fn(mut call_expr ast.CallExpr) table.Type {
*/
if !c.check_types(typ, arg.typ) {
// str method, allow type with str method if fn arg is string
if arg_typ_sym.kind == .string && typ_sym.has_method('str') {
continue
}
// Passing an int or a string array produces a c error here
// Deleting this condition results in propper V error messages
// if arg_typ_sym.kind == .string && typ_sym.has_method('str') {
// continue
// }
if typ_sym.kind == .void && arg_typ_sym.kind == .string {
continue
}