From 3bd645517826d3a897b0827b86b42d25af146700 Mon Sep 17 00:00:00 2001 From: playX Date: Wed, 4 May 2022 09:08:34 +0000 Subject: [PATCH] checker: allow rune->any int and vice versa when translated (#14285) --- vlib/v/checker/check_types.v | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vlib/v/checker/check_types.v b/vlib/v/checker/check_types.v index 632167576b..135bc2548a 100644 --- a/vlib/v/checker/check_types.v +++ b/vlib/v/checker/check_types.v @@ -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_ {