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

parser: fix type alias type check

This commit is contained in:
BigBlack 2019-12-17 00:06:40 +08:00 committed by Alexander Medvednikov
parent b7c477cc18
commit 8c0e0f8ab7

View File

@ -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)