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

checker: do not allow aliases of chan types (#6294)

This commit is contained in:
Uwe Krüger 2020-09-03 02:03:31 +02:00 committed by GitHub
parent cc714ca5cc
commit b8617ace53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -269,6 +269,8 @@ pub fn (mut c Checker) type_decl(node ast.TypeDecl) {
orig_sym := c.table.get_type_symbol((typ_sym.info as table.Alias).parent_type) orig_sym := c.table.get_type_symbol((typ_sym.info as table.Alias).parent_type)
c.error('type `$typ_sym.str()` is an alias, use the original alias type `$orig_sym.source_name` instead', c.error('type `$typ_sym.str()` is an alias, use the original alias type `$orig_sym.source_name` instead',
node.pos) node.pos)
} else if typ_sym.kind == .chan {
c.error('aliases of `chan` types are not allowed.', node.pos)
} }
} }
ast.FnTypeDecl { ast.FnTypeDecl {