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

compiler: allow function expecting a void* to receive a byteptr

This commit is contained in:
bogen85 2019-11-28 00:44:43 -06:00 committed by Alexander Medvednikov
parent e63300e286
commit 9374168b26
2 changed files with 38 additions and 18 deletions

19
vlib/builtin/isnil_test.v Normal file
View File

@ -0,0 +1,19 @@
fn test_isnil_byteptr(){
pb := byteptr(0)
assert isnil( pb )
}
fn test_isnil_voidptr(){
pv := voidptr(0)
assert isnil( pv )
}
fn test_isnil_charptr(){
pc := &char(0)
assert isnil( pc )
}
fn test_isnil_intptr(){
pi := &int(0)
assert isnil( pi )
}

View File

@ -1161,6 +1161,7 @@ fn (p mut Parser) fn_call_args(f mut Fn) {
} }
// println('\ne:"$expected" got:"$got"') // println('\ne:"$expected" got:"$got"')
else if ! (expected == 'void*' && got == 'int') && else if ! (expected == 'void*' && got == 'int') &&
! (expected == 'void*' && got == 'byteptr') &&
! (expected == 'byte*' && got.contains(']byte')) && ! (expected == 'byte*' && got.contains(']byte')) &&
! (expected == 'byte*' && got == 'string') && ! (expected == 'byte*' && got == 'string') &&
//! (expected == 'void*' && got == 'array_int') { //! (expected == 'void*' && got == 'array_int') {