TS8068
프런트엔드 코드 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.
레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
발생 조건
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).
예제
"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.)}빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.
TS8068 warning, 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, 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
고치는 법
같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.
"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.)}이 코드가 적용하는 규칙
- 규칙 2.1 테스트
- Every author-facing name must come from exactly one of three sources:
- 규칙 3.2 테스트
- A local variable, parameter, module constant or module variable may use any identifier TypeScript permits.
- 규칙 3.4 테스트
- 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.
- 규칙 12.3 테스트
- 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. - 규칙 12.6 테스트
- 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.
함께 보기
-
TS8015BACKEND - 프런트엔드가 받아들인 모듈을 백엔드가 출력하지 못하고 거부했습니다. 메시지는 백엔드가 쓴 그대로입니다.
소스
커밋 c66579bf에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.