f-string interpolation calls `str` by name, so a user binding named `str` changes every f-string
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- c
- 领域
- compilers, testing-qa
调研方向
Start in the f-string block of src/lexer.c and inspect the lowering used by the VM, then compare the ouroboros frontend/AOT path. Run the two reproductions with EIGS_JIT_OFF=1 and use tests/test_fstrings.eigs as the regression-test entry point. Done means the global, defined, and function-local str cases produce the specified result or fail loudly, with both lowering paths aligned.
由索引模型根据 Issue 内容生成。
描述
The lexer lowers f"a{e}b" to ("a" + (str of (e)) + "b") using an ordinary TOK_IDENT "str" (src/lexer.c, f-string block). That identifier is resolved like any other name at run time. A program that binds str therefore changes, or breaks, every f-string evaluated in that scope. Nothing in the source of the f-string mentions str.
Reproduce (origin/main 94c4c5b, release build)
define str(x) as:
return "HIJACK"
print of f"<{5}>"
Actual: exit 0, stdout <HIJACK>. Expected: <5> (or a loud error, if rebinding str is to be forbidden).
str is 3
print of f"<{str}>"
Actual: exit 1, Error line 2: cannot call num. The failing call is one the user never wrote.
The first case is a silent wrong answer (PRINCIPLES.md §2). A str local inside a function body does the same thing to every f-string in that function.
Done when
- f-string interpolation converts values with the builtin conversion no matter what
stris bound to in the enclosing scopes (for example, a dedicated opcode or a reserved internal name the user cannot bind). The alternative is a decision, recorded here, that rebindingstris an error. - Both programs above print
<5>and<3>(or fail loudly at the rebinding, if that is the decision), under the VM and withEIGS_JIT_OFF=1. - A regression in
tests/test_fstrings.eigscovers a globalstr, adefine str, and a function-localstr. - The ouroboros frontend/AOT mirror whatever lowering is chosen (it lowers f-strings the same way).
Found while fixing #1244, where the synthetic str token is now marked as having no source span so LSP rename never edits it; this issue is about the runtime meaning of that token.
- 主要语言
- C
- 星标
- 3
- 派生
- 7
- 平均合并
- 4 小时 7 分钟
- 30 天内合并 PR
- 112
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
InauguralSystems/EigenScript 的其他 Issue
-
area:embed kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 78/100
InauguralSystems/EigenScript#1387 ·
维护者通常 1 天内回复
-
area:stdlib kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 86/100
InauguralSystems/EigenScript#1378 ·
维护者通常 1 天内回复
-
area:gates kind:gate-defect
难度 2/5 1-3 小时 新手友好度 78/100
InauguralSystems/EigenScript#1374 ·
维护者通常 1 天内回复
-
Error carets pad multi-byte UTF-8 byte-for-byte, so the ^ lands right of the token on a terminal未关闭area:lint-tooling kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 84/100
InauguralSystems/EigenScript#1373 ·
维护者通常 1 天内回复
-
area:gates kind:docs-drift
难度 1/5 1 小时以内 新手友好度 88/100
InauguralSystems/EigenScript#1372 ·
维护者通常 1 天内回复
查看 InauguralSystems/EigenScript 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 90/100
BasedHardware/omi#19711 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
microsoft/ebpf-for-windows#5604 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
trezor/trezor-firmware#7985 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 2 天内回复