Rule 3.3
On this page

Rule 3.3

Chapter 3, Textual structure and names Test

A local variable, parameter, module constant or module variable named by a WGSL keyword or reserved word must receive a fresh backend spelling, with every reference rewritten. A WGSL keyword or reserved word on another declaration remains an error on that declaration.

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

Rationale

WGSL must contain no reserved identifier, while a legal TypeScript variable name can be represented without changing its value or authored identity.

Derives from

WGSL’s keywords and reserved words, carried as WGSL_RESERVED in src/core/reserved-words.ts.

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:

sanitizeVariableNames through wgslBackend, reportReservedNames for remaining declarations, and src/compiler/ts/reserved-names.test.ts (surface §62).

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:

See also

Source

The rule at commit 26de7be8:

Edit this page Report a problem