규칙 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 @builtin 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; 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). 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); no name is added (Rules 2.1 and 9.6), and the table’s targets are checked against the ambient library (Rule 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.
커밋 c66579bf에서 이 규칙을 확인하는 파일입니다. 파일마다 규칙을 처음 가리키는 줄로 연결했습니다.
설명하는 절
커밋 c66579bf의 표면 문서에서 이 규칙을 설명하는 절입니다.
함께 보기
소스
커밋 c66579bf의 규칙 원문:
docs/language-design.md:1247(설계 문서)reqs/rules/RULE-1201.md(추적 항목)