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

compiler: allow "u64_var == 0" without casting the const literal

This commit is contained in:
Alexander Medvednikov
2019-09-23 02:14:10 +03:00
parent a585c8c22c
commit b4207e1be7
3 changed files with 15 additions and 4 deletions

View File

@ -610,6 +610,13 @@ fn (p mut Parser) _check_types(got_, expected_ string, throw bool) bool {
if expected=='void*' && got=='int' {
return true
}
// Allow `myu64 == 1`
//if p.fileis('_test') && is_number_type(got) && is_number_type(expected) {
//p.warn('got=$got exp=$expected $p.is_const_literal')
//}
if is_number_type(got) && is_number_type(expected) && p.is_const_literal {
return true
}
expected = expected.replace('*', '')
got = got.replace('*', '')
if got != expected {