Rule 6.5
On this page

Rule 6.5

Chapter 6, Declarations and resources Test

A top-level let is a module variable in the per-invocation (private) address space; workgroup memory must be written let x: workgroup<T>; a module variable must take no declare.

The rule text and the parts under it are the compiler's own English, as the design document writes them.

Rationale

a module-level let already says “a value this invocation owns”, so the address space is read off the syntax and only the space TypeScript cannot express gets a wrapper.

Derives from

Address Spaces; surface §24; the roadmap’s first rule.

How it is verified

Checked by a test. A test, a gate script or a CI workflow names this rule, and the traceability check fails when a file listed below stops naming it.

Where the rule says the compiler enforces it:

TS8033 MODULE_VAR and src/compiler/ts/module-vars.test.ts.

The files that verify it at commit 26de7be8, each at the first line that names the rule:

Explained in

The sections of the surface document that explain this rule, at commit 26de7be8:

Error codes that enforce it

The diagnostic codes the rule names under Enforced by, or whose registry text names the rule:

TS8033 MODULE_VAR
A module variable (let x: workgroup<T>, let y: T = init, §24) declared or used where its address space forbids: a const with an address-space wrapper, a workgroup variable with an initializer, a type the space cannot hold (a texture, a runtime-sized array, an atomic in a per-invocation variable), an initializer that is not a constant, or a workgroup variable reached from a vertex or fragment entry (roadmap 0.2 item 5).

See also

Source

The rule at commit 26de7be8:

Edit this page Report a problem