Skip to content

Commit

Permalink
ast: fix global const ordering with string inter literal (fix #20760) (
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Feb 10, 2024
1 parent 729a1cb commit 16574df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vlib/v/ast/table.v
Expand Up @@ -2418,6 +2418,11 @@ pub fn (t &Table) dependent_names_in_expr(expr Expr) []string {
PrefixExpr {
names << t.dependent_names_in_expr(expr.right)
}
StringInterLiteral {
for inter_expr in expr.exprs {
names << t.dependent_names_in_expr(inter_expr)
}
}
SelectorExpr {
names << t.dependent_names_in_expr(expr.expr)
}
Expand Down
9 changes: 9 additions & 0 deletions vlib/v/tests/const_order_with_str_interp_test.v
@@ -0,0 +1,9 @@
import os

const exe_path = os.executable()
const exe_old_path = '${exe_path}.old'

fn test_main() {
assert exe_path == os.executable()
assert exe_old_path == '${os.executable()}.old'
}

0 comments on commit 16574df

Please sign in to comment.