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

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

This commit is contained in:
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

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
}