checker: allow rune->any int and vice versa when translated (#14285)

master
playX 2022-05-04 09:08:34 +00:00 committed by GitHub
parent 3d4b8dffdf
commit 3bd6455178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -32,6 +32,12 @@ pub fn (mut c Checker) check_types(got ast.Type, expected ast.Type) bool {
return true
}
}
// allow rune -> any int and vice versa
if (expected == ast.rune_type && got.is_int())
|| (got == ast.rune_type && expected.is_int()) {
return true
}
got_sym := c.table.sym(got)
expected_sym := c.table.sym(expected)
if got_sym.kind == .enum_ {