---
title: "규칙 6.7: 선언과 리소스, TypeShade 셰이더 언어 설계 규칙과 그 근거, 출처, 검증 방식"
description: "TypeShade 언어 설계 규칙 6.7(선언과 리소스)입니다. The attribute names the compiler reads are vertex, fragment, compute, workgroup_size, builtin, location…"
url: https://typeshade.dev/ko/reference/rules/6-7/
language: ko
---

# 규칙 6.7

6장, 선언과 리소스 테스트

The attribute names the compiler reads are `vertex`, `fragment`, `compute`, `workgroup_size`, `builtin`, `location`, `interpolate`, `invariant` and `blend_src` (the last three since [#168](https://github.com/typeshade/typeshade/issues/168), surface §53). A stage is an attribute on the entry’s function declaration (`@vertex`, `@fragment`, `@compute([x, y?, z?])`, [Rule 8.1](https://typeshade.dev/ko/reference/rules/8-1/)), and a kernel’s size the optional attribute `@workgroup_size([n])` ([Rule 8.22](https://typeshade.dev/ko/reference/rules/8-22/)); `builtin` and `location` are types and `interpolate`, `invariant` and `blend_src` their options ([Rule 6.6](https://typeshade.dev/ko/reference/rules/6-6/)). `@inout` and `@out` are no attributes: a parameter that writes one is [`TS8073`](https://typeshade.dev/ko/reference/errors/ts8073/) ([Rule 8.25](https://typeshade.dev/ko/reference/rules/8-25/), change 0142). Change 0131 removed `numerics`, and a leftover `numerics(...)` is an unknown function ([`TS8004`](https://typeshade.dev/ko/reference/errors/ts8004/)); change 0132 removed `diagnostic`, whose work the compiler’s rewrite does ([Rule 8.5](https://typeshade.dev/ko/reference/rules/8-5/)), and a leftover `@diagnostic(…)` decorator is [`TS8028`](https://typeshade.dev/ko/reference/errors/ts8028/), which says to delete it; an option written on a stage call is named in the refusal of the call. Every other WGSL attribute is inferred by the compiler. The calls `vertex(f)`, `fragment(f)`, `compute([…], f)` and `workgroup_size([…], f)` must be refused with `TS8028`, whose text names the attribute and `tshc migrate` (change 0130, D4, as amended by change 0140); the decorators `@builtin`, `@location`, `@interpolate`, `@invariant` and `@blend_src` on a parameter or a field stay as change 0111 D5 says; a decorator outside the list must be refused.

규칙 본문과 그 아래 항목은 설계 문서에 적힌 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.

## 근거

a misspelled attribute or stage name would otherwise silently stop a function being an entry point. The attributes keep WGSL’s names (change 0100, change 0111 Amendment 1); a stage marks a function, so it is an attribute on the function’s declaration, and an input or an output is a value, so its attribute is part of its type ([Rule 1.8](https://typeshade.dev/ko/reference/rules/1-8/)).

## 출처

[Attributes](https://gpuweb.github.io/gpuweb/wgsl/#attributes); the fixture’s `attributes` list against the ambient library; change `0111` in `changes/`; change `0130`; change `0137`; change `0140`.

## 검증 방식

테스트로 확인합니다. 테스트나 게이트 스크립트, CI 워크플로가 이 규칙을 가리키고, 아래 파일 가운데 하나라도 규칙을 더는 가리키지 않으면 추적 검사가 실패합니다.

컴파일러가 이 규칙을 적용하는 곳을 규칙이 직접 적은 내용입니다.

`src/compiler/ts/stage-call.ts` for the refusal of the stage calls: one [`TS8028`](https://typeshade.dev/ko/reference/errors/ts8028/), an error, on the name called, in both halves (`a stage is an attribute on the function declaration: write "@vertex export function vs(…)", or run "tshc migrate" (change 0130)`), with an option named in the same diagnostic and what TypeScript says of the call’s arguments merged into it, and nothing else said about the refused entry ([Rule 12.4](https://typeshade.dev/ko/reference/rules/12-4/)), pinned by `src/compiler/ts/stage-call.test.ts` (each of the four calls, a call with options, an arrow function and a function expression, a call in a namespace, a call that declares no entry, the file’s own declaration of such a name, which is not refused, and the file `tshc migrate` writes for each refused form, which compiles), `src/compiler/ts/numerics-removed.test.ts` and, for `diagnostic`, `src/compiler/ts/diagnostic-removed.test.ts`; and `src/compiler/ts/attribute-types.ts` for the attribute types, each read as the decorators it stands for, pinned by `src/compiler/ts/attribute-types.test.ts` and `src/language-service/new-entry-forms.test.ts` (the editor’s symbols, hover and completion on the attribute form, and no entry shown for a refused call); `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]); on a kernel function, @workgroup_size([n]).`), 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](https://typeshade.dev/ko/reference/rules/12-6/); on an overload signature, `Write it on the implementation.`); a method’s decorator, a function-valued field’s included ([Rule 8.16](https://typeshade.dev/ko/reference/rules/8-16/)), is [`TS8035`](https://typeshade.dev/ko/reference/errors/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 stage attribute or `@workgroup_size` on a namespace’s function as it takes one on a top-level function, in every file ([Rule 1.7](https://typeshade.dev/ko/reference/rules/1-7/)), a removed parameter qualifier `@inout` or `@out` on such a function’s parameter in every file, which the compiler refuses with [`TS8073`](https://typeshade.dev/ko/reference/errors/ts8073/) ([Rule 8.25](https://typeshade.dev/ko/reference/rules/8-25/)), and another decorator on such a function’s parameter only while `compile()` warns on it ([Rule 6.6](https://typeshade.dev/ko/reference/rules/6-6/)), since the compiler reads both ([Rule 12.7](https://typeshade.dev/ko/reference/rules/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`.

커밋 af54ddad5에서 이 규칙을 확인하는 파일입니다. 파일마다 규칙을 처음 가리키는 줄로 연결했습니다.

- [`src/compiler/ts/attribute-types.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/attribute-types.test.ts#L1)
- [`src/compiler/ts/attribute-types.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/attribute-types.ts#L1)
- [`src/compiler/ts/decorated-form.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/decorated-form.test.ts#L1)
- [`src/compiler/ts/decorated-form.ts:2`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/decorated-form.ts#L2)
- [`src/compiler/ts/diagnostic-removed.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/diagnostic-removed.test.ts#L1)
- [`src/compiler/ts/io-attribute-arguments.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/io-attribute-arguments.test.ts#L1)
- [`src/compiler/ts/kernel-workgroup.test.ts:2`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/kernel-workgroup.test.ts#L2)
- [`src/compiler/ts/numerics-removed.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/numerics-removed.test.ts#L1)
- [`src/compiler/ts/stage-call.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/stage-call.test.ts#L1)
- [`src/compiler/ts/stage-call.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/stage-call.ts#L1)
- [`src/compiler/ts/stage3.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/stage3.test.ts#L1)
- [`src/core/spec-conformance/surface-names.test.ts:52`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/spec-conformance/surface-names.test.ts#L52)
- [`src/language-service/new-entry-forms.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/new-entry-forms.test.ts#L1)
- [`src/language-service/service-output-and-cache.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/service-output-and-cache.test.ts#L1)
- [`src/language-service/service.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/service.test.ts#L1)

## 설명하는 절

커밋 af54ddad5의 언어 문서에서 이 규칙을 설명하는 절입니다.

- [§3 Entries — stage attributes and explicit builtins](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#3-entries--stage-attributes-and-explicit-builtins)
- [§7 Diagnostics (required)](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#7-diagnostics-required)
- [§53 Entry IO: the interpolation an integer varying has no choice about](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#53-entry-io-the-interpolation-an-integer-varying-has-no-choice-about)

## 적용하는 오류 코드

규칙이 Enforced by 항목에서 가리키는 진단 코드와, 레지스트리 설명에서 이 규칙을 가리키는 진단 코드입니다.

**[`TS8028`](https://typeshade.dev/ko/reference/errors/ts8028/) `ATTRIBUTE_NAME`**

이 표면이 읽지 않는 데코레이터나 진입점 형태입니다. 속성 어휘(`@vertex`, `@fragment`, `@compute`, `@builtin`, `@location`) 밖의 식별자(`@vertx` 같은 오타), 표면이 다른 방식으로 쓰거나 빌려 오지 않는 WGSL 속성(직접 쓴 `@diagnostic(…)` 같은 것), `vertex(f)`처럼 호출로 쓴 스테이지, `export default`처럼 [규칙 8.1](https://typeshade.dev/ko/reference/rules/8-1/)이 거부하는 형태로 쓴 진입점, 데코레이터를 받지 않는 선언이나 자리에 붙은 데코레이터가 그렇습니다(규칙 6.7). 이 코드가 없으면 데코레이터를 붙인 함수나 필드가 아무 말 없이 진입점이나 IO 필드가 아니게 됩니다.

**[`TS8035`](https://typeshade.dev/ko/reference/errors/ts8035/) `CLASS_MEMBER`**

표면이 받지 않는 클래스 멤버 모양, 클래스 규칙이 거부하는 멤버 사용, 클래스를 만들지 않는 `new`입니다([규칙 8.13](https://typeshade.dev/ko/reference/rules/8-13/)). getter와 setter, static 필드와 메서드, 오버로드 시그니처, abstract 멤버, `#` 비공개 이름, 객체를 바꾸는 메서드는 모두 컴파일됩니다. 메시지가 멤버나 대상과 고칠 방법을 알려 줍니다.

**[`TS8073`](https://typeshade.dev/ko/reference/errors/ts8073/) `REFERENCE`**

아직 지원하지 않는 참조 형태입니다([규칙 8.8](https://typeshade.dev/ko/reference/rules/8-8/), 변경 0142). 객체 매개변수는 표시 없이도 호출자의 객체이므로 없앤 `@inout`과 `@out`, 이름이 있는 객체를 돌려줄 수 있는 호출이 그렇습니다. 메시지가 고칠 방법을 알려 줍니다.

## 함께 보기

- [규칙 6.6](https://typeshade.dev/ko/reference/rules/6-6/) 테스트
- [규칙 6.8](https://typeshade.dev/ko/reference/rules/6-8/) 테스트
- [규칙 1.7](https://typeshade.dev/ko/reference/rules/1-7/)
- [규칙 1.8](https://typeshade.dev/ko/reference/rules/1-8/)
- [규칙 8.1](https://typeshade.dev/ko/reference/rules/8-1/)
- [규칙 8.5](https://typeshade.dev/ko/reference/rules/8-5/)
- [규칙 8.16](https://typeshade.dev/ko/reference/rules/8-16/)
- [규칙 8.22](https://typeshade.dev/ko/reference/rules/8-22/)
- [규칙 8.25](https://typeshade.dev/ko/reference/rules/8-25/)
- [규칙 12.4](https://typeshade.dev/ko/reference/rules/12-4/)
- [규칙 12.6](https://typeshade.dev/ko/reference/rules/12-6/)
- [규칙 12.7](https://typeshade.dev/ko/reference/rules/12-7/)
- [설계 규칙](https://typeshade.dev/ko/reference/rules/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

커밋 af54ddad5의 규칙 원문:

- [`docs/language-design.md:559`](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/language-design.md#L559) (설계 문서)
- [`reqs/rules/RULE-0607.md`](https://github.com/typeshade/typeshade/blob/af54ddad5/reqs/rules/RULE-0607.md) (추적 항목)
