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

table: fix float/integer cast bug

This commit is contained in:
Alexander Medvednikov 2019-11-08 02:04:00 +03:00
parent f579376638
commit 27f6b2dd73

View File

@ -671,11 +671,11 @@ fn (p mut Parser) check_types2(got_, expected_ string, throw bool) bool {
if expected=='void*' && got=='int' { if expected=='void*' && got=='int' {
return true return true
} }
// Allow `myu64 == 1`
//if p.fileis('_test') && is_number_type(got) && is_number_type(expected) { //if p.fileis('_test') && is_number_type(got) && is_number_type(expected) {
//p.warn('got=$got exp=$expected $p.is_const_literal') //p.warn('got=$got exp=$expected $p.is_const_literal')
//} //}
if is_number_type(got) && is_number_type(expected) && p.is_const_literal { // Allow `myu64 == 1`, `myfloat == 2` etc
if is_integer_type(got) && is_number_type(expected) && p.is_const_literal {
return true return true
} }