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

v.parser: support imported enums as map keys (#10234)

This commit is contained in:
Lukas Neubert
2021-05-28 19:09:03 +02:00
committed by GitHub
parent e09f0234ea
commit 6b683d31ac
4 changed files with 34 additions and 3 deletions

View File

@@ -92,8 +92,8 @@ pub fn (mut p Parser) parse_map_type() ast.Type {
return 0
}
key_type_supported := key_type in [ast.string_type_idx, ast.voidptr_type_idx]
|| key_sym.kind == .enum_ || ((key_type.is_int() || key_type.is_float()
|| is_alias) && !key_type.is_ptr())
|| key_sym.kind == .enum_ || key_sym.kind == .placeholder
|| ((key_type.is_int() || key_type.is_float() || is_alias) && !key_type.is_ptr())
if !key_type_supported {
if is_alias {
p.error('cannot use the alias type as the parent type is unsupported')