From f332e858d1eb02835be728610757568e16d4de15 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 1 Oct 2019 14:43:26 +0300 Subject: [PATCH] compiler: enhanced wording of obsolete import const error message --- compiler/parser.v | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/parser.v b/compiler/parser.v index 3bc769a3e4..60523203a3 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -469,9 +469,13 @@ fn (p mut Parser) import_statement() { } fn (p mut Parser) const_decl() { - if p.tok == .key_import { - p.error('`import const` was removed from the language, ' + - 'use `foo(C.CONST_NAME)` instead') + if p.tok == .key_import { + p.error_with_token_index( + '`import const` was removed from the language, ' + + 'because predeclaring C constants is not needed anymore. ' + + 'You can use them directly with C.CONST_NAME', + p.cur_tok_index() + ) } p.inside_const = true p.check(.key_const)