규칙 2.3
2장, 표면 이름의 출처 테스트
A value sometimes has to cross between a representation the compiler chose and one the target has: an f64 and the two f32 halves that carry it across an interface of f32.
The compiler must either perform the bridge silently or refuse the program in one sentence naming an ordinary remedy.
A spelling of the bridge, under any name, must not be a third option.
규칙 본문과 그 아래 항목은 설계 문서에 적힌 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
근거
the two honest answers to “the target cannot take this as written” are to make it work or to say what to write instead; a third spelling the author has to learn is neither.
출처
the same section of PR #166; the roadmap’s first rule, “ordinary TypeScript first”.
검증 방식
테스트로 확인합니다. 테스트나 게이트 스크립트, CI 워크플로가 이 규칙을 가리키고, 아래 파일 가운데 하나라도 규칙을 더는 가리키지 않으면 추적 검사가 실패합니다.
컴파일러가 이 규칙을 적용하는 곳을 규칙이 직접 적은 내용입니다.
TS8038 F64_ENTRY_IO(src/compiler/ts/lower/function.ts, PR #166) for anf64on an entry’s@locationparameter, on an entry I/O struct field, or on an entry’s return, one sentence that namesf32(x)and the uniform or storage binding as the two remedies (surface §39), pinned bysrc/compiler/ts/f64-types.test.ts;- a
TS8003that names no remedy, for anf64passed, returned, or assigned where anf32is declared (Appendix B); - the surface-names test, which catches a spelling of the bridge that is a pre-emit id, a second signature of
f64, or a non-constructor signature of avecNf64, and the front end, which refuses a call of one; - review, for a spelling under a new id, which none of the cases above catches.
커밋 c66579bf에서 이 규칙을 확인하는 파일입니다. 파일마다 규칙을 처음 가리키는 줄로 연결했습니다.
설명하는 절
커밋 c66579bf의 표면 문서에서 이 규칙을 설명하는 절입니다.
적용하는 오류 코드
규칙이 Enforced by 항목에서 가리키는 진단 코드와, 레지스트리 설명에서 이 규칙을 가리키는 진단 코드입니다.
-
TS8003TYPE_MISMATCH - 연산자나 조건, 선언, 반환, 인자처럼 두 값이 만나는 자리에서 타입이 서로 맞지 않거나, 컴파일러가 접는 상수를 WGSL이 거부합니다. 31을 넘는 시프트 양, 0인 제수, 서로 엇갈린 clamp 경계, 범위를 넘는 f32 값이 그렇습니다.
-
TS8038F64_ENTRY_IO - An emulated double (
f64, avec64) on an entry's IO boundary — a@locationparameter, a@locationfield of an IO struct, or an entry's return.
함께 보기
소스
커밋 c66579bf의 규칙 원문:
docs/language-design.md:118(설계 문서)reqs/rules/RULE-0203.md(추적 항목)