---
title: "규칙 12.4: 진단, TypeShade 셰이더 언어 설계 규칙과 그 근거, 출처, 검증 방식"
description: "TypeShade 언어 설계 규칙 12.4(진단)입니다. One mistake reads as one diagnostic; a refusal must not be followed by further diagnostics about the same mistake."
url: https://typeshade.dev/ko/reference/rules/12-4/
language: ko
---

# 규칙 12.4

12장, 진단 테스트

One mistake reads as one diagnostic; a refusal must not be followed by further diagnostics about the same mistake.

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

## 근거

a cascade hides the sentence that says what to do.

## 출처

surface §28 (“and one mistake reads as one sentence”).

## 검증 방식

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

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

`honest-refusals.test.ts` (`one mistake reads as one sentence`), for the surface §28 shapes, and (`a refused declaration is the one diagnostic for its name`), for a refused declaration: a read of the name, an assignment to it or a write through it reports nothing more when an error stands inside the declaration the name resolves to or inside a declaration that one reads (`a local declared from a refused one`), while a name read out of its scope, read before its declaration or declared nowhere still reports [`TS8022`](https://typeshade.dev/ko/reference/errors/ts8022/) (`src/compiler/ts/refused-names.ts`, [#171](https://github.com/typeshade/typeshade/issues/171)); and, across the language service’s two halves, `mergeDiagnostics` (`src/language-service/diagnostics.ts`), which keeps the compiler’s diagnostic where TypeScript and the compiler report one mistake, with no exception (a misspelled name included, since the compiler names the fix itself under [Rule 12.1](https://typeshade.dev/ko/reference/rules/12-1/)), and drops TypeScript’s knock-on of a value it could not type itself (a call it failed to resolve, a name or a member it cannot find), reached directly, through a local declared with no type or through an operation, in `src/language-service/diagnostics.test.ts` (`one mistake reads as one diagnostic across the two halves`, among it a comparison of vectors of two sizes, the uses of a local whose product the compiler refused, a value from an unknown function used in an operation, and a return of the wrong type, which the compiler reports on the `return`, where TypeScript does). For the shapes two passes both refused (proposal 0008), `honest-refusals.test.ts` (`one mistake, one diagnostic, in compile() and in the editor`): `for…in` and `try`, and a `throw`, an `await`, a `yield`, a template string and a spread with what each holds, in a body and at the top level; `var` in a body, at the top level and in a namespace, one that declares a parameter again and one of a list with no type; `async` and generator functions as a declaration, a value, a class’s method, a mixin’s and an object literal’s, a body no call lowers included, with a call of each and a local declared from one; a spread in a list in a local, a module constant or variable, a field, a static field, a default and an argument, and a spread argument; a rest element in a list assigned to; a type inside a namespace, and a parameter that names it; a generic interface or object-type alias, directly and through an alias, typing a parameter, a return, a local, a module constant or variable, a binding and an array of them, a field of a class or an interface, a method’s, a static function’s or a constructor’s signature, and an `as`; each pinned whole in `compile()` and in the editor’s merged list, TypeScript’s entries included, with a use of what it declares, and the multi-file path’s in `compileTsSources`. `refused-names.ts` keeps more reads quiet there: a name whose declaration names a type refused at its declaration, or a class or interface that holds one; a `var` read outside the block it is written in; a local declared from a call of a function or a method refused where it is written, through the class it is called on; `N.x` and `N.M.x` where what a namespace declares was refused; and `C.K`, a static field refused where it is written (`staticFieldRefused`). A class whose `extends` names a base refused where it is written, `class D<T> extends B<T>` with its type parameter, is that one [`TS8002`](https://typeshade.dev/ko/reference/errors/ts8002/): nothing more is said of the base it misses, of a `new` of it or of a read of what the base would have given it (`src/compiler/ts/generic-classes.test.ts`). `mergeDiagnostics` drops TypeScript’s report of what the compiler refused whole there (`repeatsRefusal`).

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

- [`src/compiler/ts/abstract-super.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/abstract-super.test.ts#L1)
- [`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/builtin-type-diagnostic.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/builtin-type-diagnostic.test.ts#L1)
- [`src/compiler/ts/class-member-diagnostics.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/class-member-diagnostics.test.ts#L1)
- [`src/compiler/ts/compute-stage-reachability.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/compute-stage-reachability.test.ts#L1)
- [`src/compiler/ts/generic-classes.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/generic-classes.test.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/host-names.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/host-names.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/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/module-vars-atomic.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/module-vars-atomic.test.ts#L1)
- [`src/compiler/ts/refused-names.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/refused-names.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/super-constructor-diagnostics.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/super-constructor-diagnostics.test.ts#L1)
- [`src/compiler/ts/switch-validation.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/switch-validation.test.ts#L1)
- [`src/language-service/diagnostics-brand-tags.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/diagnostics-brand-tags.test.ts#L1)
- [`src/language-service/diagnostics-glsl-hlsl-names.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/diagnostics-glsl-hlsl-names.test.ts#L1)
- [`src/language-service/diagnostics-module-variables.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/diagnostics-module-variables.test.ts#L1)
- [`src/language-service/diagnostics-one-mistake.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/diagnostics-one-mistake.test.ts#L1)
- [`src/language-service/diagnostics-vector-arithmetic.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/diagnostics-vector-arithmetic.test.ts#L1)
- [`src/language-service/diagnostics.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/diagnostics.test.ts#L1)
- [`src/language-service/diagnostics.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/diagnostics.ts#L1)
- [`src/language-service/generic-arity-diagnostics.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/generic-arity-diagnostics.test.ts#L1)
- [`src/language-service/loop-control-diagnostics.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/loop-control-diagnostics.test.ts#L1)
- [`src/language-service/module-variable-diagnostics.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/language-service/module-variable-diagnostics.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)
- [§13 Integer literals](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#13-integer-literals)
- [§28 What TypeScript writes that the GPU has no word for](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#28-what-typescript-writes-that-the-gpu-has-no-word-for)
- [§68 Importing another shader module](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/use-typeshade-surface.md#68-importing-another-shader-module)

## 적용하는 오류 코드

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

**[`TS8002`](https://typeshade.dev/ko/reference/errors/ts8002/) `UNKNOWN_TYPE`**

아무것도 선언하지 않은 타입 이름입니다. 매개변수, 타입 인자, 별칭, `implements` 절, 기반 클래스 어디에 써도 걸리고, 이 표면이 매퍼가 읽는 자리에서 받지 않는 타입도 여기에 속합니다([규칙 2.1](https://typeshade.dev/ko/reference/rules/2-1/)). 파일이 선언했지만 구조체로 모으지 않은 기반은 `STRUCT_FIELD`입니다.

**[`TS8022`](https://typeshade.dev/ko/reference/errors/ts8022/) `UNKNOWN_NAME`**

TypeShade가 풀지 못하는 이름을 가리킵니다. 함수 호출(`UNKNOWN_FN`)이나 타입 이름(`UNKNOWN_TYPE`)은 아닙니다. 라이브러리가 TypeScript 자체를 위해 선언한 이름(`Object`, `Math`, `Symbol`)이나 파일이 enum, 네임스페이스, 클래스, 타입으로 선언한 이름을 값으로 읽으면, 메시지가 그 이름이 무엇인지 알려 줍니다.

## 함께 보기

- [규칙 12.3](https://typeshade.dev/ko/reference/rules/12-3/) 테스트
- [규칙 12.5](https://typeshade.dev/ko/reference/rules/12-5/) 테스트
- [규칙 12.1](https://typeshade.dev/ko/reference/rules/12-1/)
- [설계 규칙](https://typeshade.dev/ko/reference/rules/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

커밋 af54ddad5의 규칙 원문:

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