diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 2ba1e34b5d..d53dd62708 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -1391,7 +1391,7 @@ pub fn (mut p Parser) name_expr() ast.Expr { if mod != '' { enum_name = mod + '.' + enum_name } else { - enum_name = p.prepend_mod(enum_name) + enum_name = p.imported_symbols[enum_name] or { p.prepend_mod(enum_name) } } // p.warn('Color.green $enum_name ' + p.prepend_mod(enum_name) + 'mod=$mod') p.check(.dot) diff --git a/vlib/v/tests/imported_symbols_test.v b/vlib/v/tests/imported_symbols_test.v index de8f95c8b2..17ec16952e 100644 --- a/vlib/v/tests/imported_symbols_test.v +++ b/vlib/v/tests/imported_symbols_test.v @@ -15,7 +15,7 @@ fn test_imported_symbols_types() { fn test_imported_symbols_functions() { p0 := Point{x: 20 y: 40} - // method + // method assert p0.str() == '20 40' // function assert point_str(p0) == '20 40' @@ -35,4 +35,5 @@ fn vertex_count(s Shape) int { fn test_imported_symbols_enums() { assert vertex_count(.triangle) == 3 + assert vertex_count(Shape.triangle) == 3 }