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

ast: fix reference of alias char type (#12951)

This commit is contained in:
yuyi 2021-12-24 17:11:20 +08:00 committed by GitHub
parent 92bd55ded6
commit c0dcd1a9a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -671,7 +671,7 @@ pub fn (t &Table) unalias_num_type(typ Type) Type {
sym := t.sym(typ)
if sym.kind == .alias {
pt := (sym.info as Alias).parent_type
if pt <= f64_type && pt >= void_type {
if pt <= char_type && pt >= void_type {
return pt
}
}

View File

@ -0,0 +1,12 @@
module main
type ALchar = char
fn test_alias_char_type_reference() {
c1 := &char(0)
c2 := &ALchar(0)
println('${typeof(c1).name} $c1')
assert '$c1' == '0'
println('${typeof(c2).name} $c2')
assert '$c2' == '0'
}