ast: fix global const ordering with string inter literal (fix #20760) (#20770)

This commit is contained in:
Felipe Pena 2024-02-09 21:02:43 -03:00 committed by GitHub
parent 729a1cbc9f
commit 16574df99b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -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)
}

View File

@ -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'
}