Repository navigation
dynamic dispatch console not print #10322
Copy link
Copy link
Closed
Labels
bugConfirmed defect or regressionConfirmed defect or regression
Description
What happened
Nothing print console[success ? "info" : "error"]("xxxxx")
console[true ? "info" : "error"]("foobar 1") // Not print
;(true ? console.info : console.error)("foobar 2") // Not print
true ? console.info("foobar 3") : console.error("foobar 3") // OKWhat you expected
Should print.
Minimal reproduction
// Main entry point
function main(): void {
const success = true
const log1 = (...args) => {
console[success ? "info" : "error"](...args)
}
log1("[log1] Hello from Perry!")
const log2 = (...args) => {
return (success ? console.info : console.error)(...args)
}
log2("[log2] Hello from Perry!")
const log3 = (...args) => {
return success ? console.info(...args) : console.error(...args)
}
log3("[log3] Hello from Perry!")
console.log()
function dynLog<T>(obj: T, method: keyof T, arg: string) {
typeof obj[method](arg)
}
dynLog(console, "info", "dynLog console['info'] called success")
dynLog(console, "error", "dynLog console['error'] called success")
console.log()
const logger = {
info: (msg: string) => console.info(msg),
error: (msg: string) => console.error(msg),
}
dynLog(logger, "info", "dynLog logger['info'] called success")
dynLog(logger, "error", "dynLog logger['error] called success")
}
main()Command you ran:
perry compile src/main.ts -o perry-hello-2output:
Collecting modules...
Found 1 module(s): 1 native, 0 JavaScript
Generating code...
Reused cached object: \\?\F:\workspace\github\kemu1\sea-play\node_modules\.cache\perry\objects\host\d5fa85b6803e90f7.o
note: Perry workspace source not found — linking the prebuilt full stdlib (larger binary). Set PERRY_WORKSPACE_ROOT to a source checkout to enable size-optimized rebuilds.
Linking (runtime-only)...
[strip-dedup] perry_runtime.lib: stripped 31 stdlib-stub symbol def(s) so perry-stdlib wins the link (#5000)
Wrote executable: perry-hello-3.exe
strip:perry-hello-3.exe: File format not recognized
Binary size: 11.3MB
Update: 0.5.1220 → 0.5.1520 available
Run perry update to update, or visit https://www.npmjs.com/package/@perryts/perry/v/0.5.1520
./perry-hello-2.exe```output:
[log3] Hello from Perry!
dynLog logger['info'] called success
dynLog logger['error] called success
Node.js output:
❯ node src/main.ts
[log1] Hello from Perry!
[log2] Hello from Perry!
[log3] Hello from Perry!
dynLog console['info'] called success
dynLog console['error'] called success
dynLog logger['info'] called success
dynLog logger['error] called success
Environment
- Perry version: 0.5.1220
- Host OS: Windows 10
- Target:
- Rust toolchain (if building from source): rustc 1.97.1 (8bab26f4f 2026-07-14)
- Installed via: winget
Diagnostic output
Perry Doctor
Environment Checks
──────────────────
✓ perry version: 0.5.1220
⚠ update status: v0.5.1520 available — run `perry update`
✓ clang (LLVM codegen): clang version 23.1.1 (https://github.com/llvm/llvm-project 6dfe1677ab8dffbc6ec13d53a1e0215d75147689)
✓ system linker (MSVC link.exe): E:\app2\Microsoft_Visual_Studio\18\BuildTools\VC\Tools\MSVC\14.51.36231\bin\Hostx64\x64\link.exe
✓ runtime library: C:\Users\legend80s\AppData\Local\Microsoft\WinGet\Packages\PerryTS.Perry_Microsoft.Winget.Source_8wekyb3d8bbwe\perry_runtime.lib
✓ project config (perry.toml): found
✓ compatibility reports (#849): mode=off (sent=0, suppressed-by-dedup=0, queued=0, cache=empty)
All critical checks passed with some warnings.
Anything else
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugConfirmed defect or regressionConfirmed defect or regression
Activity
proggeramlug commentedon Sep 20, 2026
Fixed (verified twice, independently). All four forms this issue named —
dynLog(console, …),dynLog(logger, …),console[k]andglobalThis.console[k], plusc[k]— are now byte-identical to node.Most likely closed by
ad0be3bf46(changelog.d/10629-computed-key-namespace-member.md), i.e. the #10629 / #10483 computed-key namespace-member work, rather than by anything naming this issue.