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

pull/2916/head
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

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"')
else if ! (expected == 'void*' && got == 'int') &&
! (expected == 'void*' && got == 'byteptr') &&
! (expected == 'byte*' && got.contains(']byte')) &&
! (expected == 'byte*' && got == 'string') &&
//! (expected == 'void*' && got == 'array_int') {