규칙 9.5
9장, 내장 함수와 TypeShade 확장 테스트
A function the file declares or imports (Rule 3.9) must win over a builtin of the same name, as a module-scope declaration hides a predeclared object in WGSL.
The builtins that predate the rule (those not in USER_FIRST_BUILTINS: clamp, pow, f32, and the rest of the original set) keep their precedence over a function of the module, which is a recorded divergence from WGSL in the direction of Rule 4.2.
A name a function’s body declares, a local function (Rule 8.17) or a parameter that takes a function (Rule 8.18), must win over every builtin, as TypeScript’s lookup finds it before any global.
규칙 본문과 그 아래 항목은 설계 문서에 적힌 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
근거
a program that meant the author’s function before a builtin existed must keep meaning it, and a program that meant the builtin before the rule existed must keep meaning that.
No program calling a name its own body declares meant a builtin: step(i) on a parameter step, and a local const mix = … called as mix(…), reached WGSL’s builtin before, a wrong arity or a silently different value, where TypeScript calls the author’s function.
출처
Declaration and Scope (the example “Shadowing predeclared objects”) for the first clause; surface §10 and USER_FIRST_BUILTINS in math-alias.ts for the second, which WGSL does not have; ECMAScript ResolveBinding (the innermost environment first) for the third.
검증 방식
테스트로 확인합니다. 테스트나 게이트 스크립트, CI 워크플로가 이 규칙을 가리키고, 아래 파일 가운데 하나라도 규칙을 더는 가리키지 않으면 추적 검사가 실패합니다.
컴파일러가 이 규칙을 적용하는 곳을 규칙이 직접 적은 내용입니다.
src/compiler/ts/builtins.test.ts; src/compiler/ts/closures.test.ts and src/compiler/ts/higher-order.test.ts for a local function and a parameter.
커밋 c66579bf에서 이 규칙을 확인하는 파일입니다. 파일마다 규칙을 처음 가리키는 줄로 연결했습니다.
설명하는 절
커밋 c66579bf의 표면 문서에서 이 규칙을 설명하는 절입니다.
함께 보기
소스
커밋 c66579bf의 규칙 원문:
docs/language-design.md:957(설계 문서)reqs/rules/RULE-0905.md(추적 항목)