---
title: "규칙 12.1: 진단, TypeShade 셰이더 언어 설계 규칙과 그 근거, 출처, 검증 방식"
description: "TypeShade 언어 설계 규칙 12.1(진단)입니다. A diagnostic must name the offending thing and the remedy in at most two sentences…"
url: https://typeshade.dev/ko/reference/rules/12-1/
language: ko
---

# 규칙 12.1

12장, 진단 테스트

A diagnostic must name the offending thing and the remedy in at most two sentences: the first states the mistake, and the second, when there is one, states the remedy or the reason. For a name the compiler cannot find (a value, a callee, a type, a field, a member, an assignment target, an attribute, a built-in value’s id, an extension, an import), the remedy is chosen in one order at every place a name is written: TypeShade’s spelling of a GLSL or HLSL name; else the name of the same kind that exists at that place and is spelled like it, by TypeScript’s own spelling rule with a swap of two adjacent letters counted as one edit (“Did you mean “clamp”?”); else the place’s own remedy. The span is the name itself.

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

## 근거

an author reads it against the line they wrote, and a third sentence is where the remedy gets lost.

## 출처

[Diagnostics](https://gpuweb.github.io/gpuweb/wgsl/#diagnostics); surface §7 and §28 (“one mistake reads as one sentence”); the pinned sentences of the refusal tests under `src/compiler/ts/` (`TS8031 Recursive call: "a" -> "b" -> "a". WGSL has no call stack, so a function must not take part in a call cycle.`), which have that shape.

## 검증 방식

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

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

every refusal test asserts the code and the message text ([Rule 12.5](https://typeshade.dev/ko/reference/rules/12-5/)). A GLSL or HLSL name the compiler refuses names TypeShade’s spelling as its remedy rather than “declare it in this file” (`lerp` is `mix`, `gl_FragCoord` a `builtin<"position">` parameter), from `FOREIGN_NAMES` in `src/compiler/ts/foreign-names.ts`, in `src/compiler/ts/foreign-names.test.ts` ([#218](https://github.com/typeshade/typeshade/issues/218)); no name is added ([Rules 2.1](https://typeshade.dev/ko/reference/rules/2-1/) and [9.6](https://typeshade.dev/ko/reference/rules/9-6/)), and the table’s targets are checked against the ambient library ([Rule 12.7](https://typeshade.dev/ko/reference/rules/12-7/)). The order for an unknown name is `unknownNameRemedy` in `src/compiler/ts/unknown-names.ts`, pinned at each place a name is written by `src/compiler/ts/unknown-names.test.ts`; that the compiler names every name TypeScript would suggest for a misspelling is `src/language-service/editor-parity.test.ts`.

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

- [`src/compiler/ts/array-minmax-types.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/array-minmax-types.test.ts#L1)
- [`src/compiler/ts/foreign-names.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/foreign-names.test.ts#L1)
- [`src/compiler/ts/foreign-names.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/foreign-names.ts#L1)
- [`src/compiler/ts/honest-refusals-tuples.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/honest-refusals-tuples.test.ts#L1)
- [`src/compiler/ts/honest-refusals.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/honest-refusals.test.ts#L1)
- [`src/compiler/ts/io-name-cascades.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/io-name-cascades.test.ts#L1)
- [`src/compiler/ts/static-read-wording.test.ts:2`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/static-read-wording.test.ts#L2)
- [`src/compiler/ts/unknown-names.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/unknown-names.test.ts#L1)
- [`src/compiler/ts/unknown-names.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/unknown-names.ts#L1)
- [`src/language-service/editor-parity.test.ts:2`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/editor-parity.test.ts#L2)

## 설명하는 절

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

- [§7 Diagnostics (required)](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#7-diagnostics-required)

## 함께 보기

- [규칙 11.27](https://typeshade.dev/ko/reference/rules/11-27/) 테스트
- [규칙 12.2](https://typeshade.dev/ko/reference/rules/12-2/) 리뷰
- [규칙 2.1](https://typeshade.dev/ko/reference/rules/2-1/)
- [규칙 9.6](https://typeshade.dev/ko/reference/rules/9-6/)
- [규칙 12.5](https://typeshade.dev/ko/reference/rules/12-5/)
- [규칙 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:1723`](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/language-design.md#L1723) (설계 문서)
- [`reqs/rules/RULE-1201.md`](https://github.com/typeshade/typeshade/blob/af54ddad5/reqs/rules/RULE-1201.md) (추적 항목)
