규칙 12.6
12장, 진단 테스트
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.
규칙 본문과 그 아래 항목은 설계 문서에 적힌 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
근거
WGSL checks each requirement at the earliest opportunity, and for TypeShade the earliest opportunity is the source line.
출처
Errors (“each requirement will be checked at the earliest opportunity”); surface §3 and §7.
검증 방식
테스트로 확인합니다. 테스트나 게이트 스크립트, CI 워크플로가 이 규칙을 가리키고, 아래 파일 가운데 하나라도 규칙을 더는 가리키지 않으면 추적 검사가 실패합니다.
컴파일러가 이 규칙을 적용하는 곳을 규칙이 직접 적은 내용입니다.
TS8029, TS8031, TS8036, TS8038, TS8068, and the rest of the front-end codes, among them TS8002 for a type the file declares nowhere, which used to be emitted as a struct of that name for Tint to refuse (src/compiler/ts/unknown-names.test.ts); the requirements proposal 0008 moved forward from Tint: a for update the lowering does not count, refused instead of dropped with its loop (Rule 7.5), an operator WGSL has no overload for on its operands’ kind (Rule 7.1), a vector of bools in a uniform or storage binding (Rule 6.8), a decorator nothing reads, @group and @binding on a declaration among them (Rule 6.7), a barrier, a derivative or a workgroupUniformLoad after a non-uniform break or continue (Rule 8.5), and a while condition that is not a bool (Rule 7.5), each pinned where that rule’s Enforced-by names it, and a loop’s hidden counter, which an author’s _w or _i reached (Rule 2.2), pinned by src/compiler/ts/loop-shapes.test.ts; two constant expressions Tint refused, now folded as a divisor is and refused with TS8003: a clamp whose bounds cross (src/compiler/ts/clamp-bounds.test.ts, #373) and an f32 value past the range (src/compiler/ts/f32-const-range.test.ts, #374); the debts of Appendix B are the requirements not yet moved forward.
커밋 c66579bf에서 이 규칙을 확인하는 파일입니다. 파일마다 규칙을 처음 가리키는 줄로 연결했습니다.
설명하는 절
커밋 c66579bf의 표면 문서에서 이 규칙을 설명하는 절입니다.
적용하는 오류 코드
규칙이 Enforced by 항목에서 가리키는 진단 코드와, 레지스트리 설명에서 이 규칙을 가리키는 진단 코드입니다.
-
TS8002UNKNOWN_TYPE - A type name nothing declares, said once for the file wherever it is written (a parameter, a claim, a type argument,
B<vec3<Foo>>included, an alias, animplementsclause, the base a class or an interface extends, a body no call lowers), a type the library declares for TypeScript alone (Number) where the file declares none of its name, or a type this surface does not take in a position the mapper reads (Rule 2.1). -
TS8003TYPE_MISMATCH - 연산자나 조건, 선언, 반환, 인자처럼 두 값이 만나는 자리에서 타입이 서로 맞지 않거나, 컴파일러가 접는 상수를 WGSL이 거부합니다. 31을 넘는 시프트 양, 0인 제수, 서로 엇갈린 clamp 경계, 범위를 넘는 f32 값이 그렇습니다.
-
TS8029STRUCT_FIELD_MISSING_ATTR - A field of a struct used as an entry function's parameter or return type carries neither
@builtin(...)nor@location(...): WGSL rejects an entry-IO struct member with no attribute, so this is caught at the front end instead of reaching the backend as invalid emitted WGSL. -
TS8031RECURSION - A call cycle: a function that reaches itself, directly or through other functions.
-
TS8036MATH_ARGUMENT - A math builtin called with arguments its signature does not take: two shapes that had to agree (
dot(vec3, vec2),clamp(v, 0., 1.)with a vectorv), an element kind the builtin has no form for (sinon an integer vector,mixon one), a scalar where a vector is due (normalize(s),crosson avec2),mix's factor orrefract's eta of the wrong shape,ldexp's exponent not an i32 ofx's shape, a bit offset or count that is not au32, ortranspose/determinanton a non-matrix. -
TS8038F64_ENTRY_IO - An emulated double (
f64, avec64) on an entry's IO boundary — a@locationparameter, a@locationfield of an IO struct, or an entry's return. -
TS8068RESERVED_NAME - A declared name that a target reserves, checked on the name the emit actually carries:
halfas a struct field, which ANGLE answers with "Illegal use of reserved word" in generated text the author never wrote.
함께 보기
소스
커밋 c66579bf의 규칙 원문:
docs/language-design.md:1282(설계 문서)reqs/rules/RULE-1206.md(추적 항목)