TS8068
Front-end code RESERVED_NAME
A declared name that a target reserves, checked on the name the emit actually carries: half as a struct field, which ANGLE answers with "Illegal use of reserved word" in generated text the author never wrote.
The registry text and every compiler message on these pages are the compiler's own English.
When it fires
A declared name that a target reserves, checked on the name the emit actually carries: half as a struct field, which ANGLE answers with "Illegal use of reserved word" in generated text the author never wrote. The message names the target that reserves the word, and the emitted name when the flattening (Cls_member, Ns_member) made it differ from the written one. A module with no GLSL form is not held to GLSL ES 3.00's list. A name that contains $, which WGSL's identifier profile leaves out, remains refused on interface declarations whose emitted names are part of their contract. Legal local, parameter, module-constant and module-variable names are escaped by the backend instead (Rule 3.2). The same code refuses eval and arguments where a variable, a parameter or a function binds one, which ECMAScript's strict mode, and TypeScript with it, lets no declaration do (Rule 2.1).
Example
"use typeshade"
class Weights { half: f32 rest: f32}
@fragmentexport function main(@location(0) uv: vec2): vec4 { const w: Weights = { half: 0.5, rest: 0.5 } return vec4(uv * w.half, 0., 1.)}Compiled at build time against the pinned compiler, this program gets:
TS8068 warning, line 4: "half" is reserved in GLSL ES 3.00, so a field of that name cannot be emitted for the WebGL2 target. Rename it.
TS8015 warning, line 1: Backend emit failed: glsl-es300: field 'Weights.half' is a GLSL ES 3.00 reserved word and cannot be renamed here; pick another name
How to fix it
The same program, corrected. It compiles with no diagnostic.
"use typeshade"
class Weights { low: f32 rest: f32}
@fragmentexport function main(@location(0) uv: vec2): vec4 { const w: Weights = { low: 0.5, rest: 0.5 } return vec4(uv * w.low, 0., 1.)}The rules this enforces
- Rule 2.1 Test
- Every author-facing name must come from exactly one of three sources:
- Rule 3.2 Test
- A local variable, parameter, module constant or module variable may use any identifier TypeScript permits.
- Rule 3.4 Test
- A local variable, parameter, module constant or module variable that collides with a GLSL ES 3.00 identifier restriction must be renamed consistently by the GLSL writer; helper function renaming retains its existing behavior.
- Rule 12.3 Test
- Severity must follow the target’s role: a program WGSL refuses must be an error; a shortfall of GLSL ES 3.00 on a module with a render entry must be a warning that leaves
wgslin place; a compute-only module’s GLSL shortfall must be no diagnostic at all. - Rule 12.6 Test
- A requirement the front end can check must be checked at the front end, in the author’s words, and not left to Tint or a driver.
See also
-
TS8015BACKEND - A backend that refused to emit a module the front end accepted. The message is the backend's own.
Source
Where the compiler raises this code at commit 26de7be8, one line per file: