From f1f5ef524f67c0f06d2b0df87d5e03ccdd91df0b Mon Sep 17 00:00:00 2001 From: yuyi Date: Tue, 10 Sep 2024 17:42:19 +0800 Subject: [PATCH] ast: fix const field str() --- vlib/v/ast/str.v | 9 --------- ...ct_decl_with_const_default_value_and_comments_keep.vv | 6 +++--- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/vlib/v/ast/str.v b/vlib/v/ast/str.v index 2e95bfe188db6e..89dbaf45b95e65 100644 --- a/vlib/v/ast/str.v +++ b/vlib/v/ast/str.v @@ -518,15 +518,6 @@ pub fn (x &Expr) str() string { if x.cached_name != '' { return x.cached_name } - if obj := x.scope.find('${x.mod}.${x.name}') { - if obj is ConstField && x.mod != 'main' { - last_mod := x.mod.all_after_last('.') - unsafe { - x.cached_name = '${last_mod}.${x.name}' - } - return x.cached_name - } - } unsafe { x.cached_name = x.name.clone() } diff --git a/vlib/v/fmt/tests/struct_decl_with_const_default_value_and_comments_keep.vv b/vlib/v/fmt/tests/struct_decl_with_const_default_value_and_comments_keep.vv index bd0f2c43ff6903..2de05dfd5f7e83 100644 --- a/vlib/v/fmt/tests/struct_decl_with_const_default_value_and_comments_keep.vv +++ b/vlib/v/fmt/tests/struct_decl_with_const_default_value_and_comments_keep.vv @@ -11,9 +11,9 @@ pub mut: end_line u8 = `\n` end_line_len int = endline_cr_len // size of the endline rune \n = 1, \r\n = 2 - separator u8 = `,` // comma is the default separator - separator_len int = 1 // size of the separator rune - quote u8 = `"` // double quote is the standard quote char + separator u8 = `,` // comma is the default separator + separator_len int = 1 // size of the separator rune + quote u8 = `"` // double quote is the standard quote char quote_remove bool // if true clear the cell from the quotes comment u8 = `#` // every line that start with the quote char is ignored