mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
`const proc = globalThis.process` lowers to alias plumbing: the declaration emits no storage and no code, because member and call reads resolve through the global it names. A read that needs the VALUE therefore failed at the use with the generic "binding form with no lowering", which names neither the declaration nor the cause. Register every stdlib-global snapshot declaration (TypeScript sources only, matching the elision) and report the cause at the declaration (SC2020), naming the global and, when it has a short spelling, the type the program asked the compiler to hold. The use site keeps the inherited-blocker cascade (SC2004) instead of the generic text. An unread snapshot stays elided: reading a global has no side effects, so dropping an unread `const p = process` is observationally identical to Node, and refusing it would break programs that compile harmlessly today. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 lines
365 B
TypeScript
11 lines
365 B
TypeScript
// An initializer is never dropped. This declaration's type has no lowering,
|
|
// so the declaration is refused where it is written — it cannot compile away
|
|
// with the call in its initializer, which would run under Node.
|
|
function touch(): number {
|
|
return 1;
|
|
}
|
|
function run(): void {
|
|
const ref: WeakRef<object> = touch() as unknown as WeakRef<object>;
|
|
}
|
|
run();
|