From 8c0e0f8ab76f74eb021e961cd68402782d4ea972 Mon Sep 17 00:00:00 2001 From: BigBlack <840206@qq.com> Date: Tue, 17 Dec 2019 00:06:40 +0800 Subject: [PATCH] parser: fix type alias type check --- vlib/compiler/fn.v | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vlib/compiler/fn.v b/vlib/compiler/fn.v index 357eb68762..ed11982173 100644 --- a/vlib/compiler/fn.v +++ b/vlib/compiler/fn.v @@ -1140,6 +1140,16 @@ fn (p mut Parser) fn_call_args(f mut Fn) { p.cgen.set_placeholder(ph, '${typ}_str(') p.gen(')') continue + } else { + base := p.base_type(T.name) + if base != T.name { + base_type := p.find_type(base) + if base_type.has_method('str') { + p.cgen.set_placeholder(ph, '${base_type.name}_str(') + p.gen(')') + continue + } + } } error_msg := ('`$typ` needs to have method `str() string` to be printable') p.error(error_msg)