규칙 6.7
6장, 선언과 리소스 테스트
The attribute names the compiler reads are @vertex, @fragment, @compute, @builtin, @location, @interpolate, @invariant, @blend_src, and @diagnostic (the last four since #168, surface §53 and §54); every other WGSL attribute is either inferred by the compiler or carried as an argument (@compute([64, 1, 1]) carries @workgroup_size), and a decorator outside that list must be refused.
규칙 본문과 그 아래 항목은 설계 문서에 적힌 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
근거
a misspelled decorator would otherwise silently stop a function being an entry point.
출처
Attributes; the fixture’s attributes list against the ambient library.
검증 방식
테스트로 확인합니다. 테스트나 게이트 스크립트, CI 워크플로가 이 규칙을 가리키고, 아래 파일 가운데 하나라도 규칙을 더는 가리키지 않으면 추적 검사가 실패합니다.
컴파일러가 이 규칙을 적용하는 곳을 규칙이 직접 적은 내용입니다.
TS8028 ATTRIBUTE_NAME and surface-names.test.ts; a WGSL attribute the surface writes another way is named as WGSL’s, with where its intent goes ("@workgroup_size" is WGSL's attribute, written here as @compute's argument: @compute([64]) or @compute([8, 8]).), and not as an unknown one, @size anywhere but a field and @align anywhere but a field or a class as a struct field’s ("@align" is WGSL's attribute for a struct field, not a function. Remove it.), and @std140 anywhere but a class as not applied; every decorator nothing reads is TS8028: on a declaration that takes none (a binding of any kind, an override, a const or let at any depth, an enum, an interface, a type alias, a namespace, a local function, a local class, a class expression, a static field), on a constructor, an overload signature, an abstract member, a mixin or an index signature, on a parameter of one of those, and one that is not a name, anywhere ("@N.k" is not applied: an attribute is written "@name" or "@name(...)". Remove it.); @group and @binding are named as not applied since reflect() reports the group and slot each binding gets, @id as not applied since the host sets an override by its name, and an attribute of the list written where the place does not apply it by what it marks ("@location" does not apply to a parameter of a function that is not an entry: it marks an entry's input or output. Remove it., which Tint refuses too, Rule 12.6; on an overload signature, Write it on the implementation.); a method’s decorator, a function-valued field’s included (Rule 8.16), is TS8035 once, and the method is lowered, so a call of it says nothing more; the editor’s merge drops whatever TypeScript says inside a decorator the compiler refuses whole, its TS1206, TS1239, TS1249 and its TS2304 on a name the ambient library does not declare, and on a method its TS2318 for TypedPropertyDescriptor (Rule 12.4), and its TS1206 filter takes a namespace’s function and its parameters as it takes a top-level one’s, since the compiler reads both (Rule 12.7); a static block, refused whole, keeps TypeScript’s TS1206 on its decorator; pinned by src/compiler/ts/stage3.test.ts, which also holds the attributes it answers for to the fixture’s WGSL list and reads the editor’s diagnostics on each case, and src/language-service/service.test.ts.
커밋 c66579bf에서 이 규칙을 확인하는 파일입니다. 파일마다 규칙을 처음 가리키는 줄로 연결했습니다.
설명하는 절
커밋 c66579bf의 표면 문서에서 이 규칙을 설명하는 절입니다.
적용하는 오류 코드
규칙이 Enforced by 항목에서 가리키는 진단 코드와, 레지스트리 설명에서 이 규칙을 가리키는 진단 코드입니다.
-
TS8028ATTRIBUTE_NAME - A decorator identifier outside the attribute vocabulary
"use typeshade"defines (@vertex,@fragment,@compute,@builtin,@location), e.g. a misspelled@vertx: without this, the decorated function or field just silently stops being an entry point or an I/O field. -
TS8035CLASS_MEMBER - A class member shape the surface does not take, or a use of a member the class rules refuse, and a
newthat builds no class (Rule 8.13).
함께 보기
소스
커밋 c66579bf의 규칙 원문:
docs/language-design.md:448(설계 문서)reqs/rules/RULE-0607.md(추적 항목)