규칙 9.2
이 페이지에서

규칙 9.2

9장, 내장 함수와 TypeShade 확장 테스트

A builtin’s signature must be WGSL’s, checked at the call. The two recorded exceptions are atan(y, x) (WGSL’s atan2) and the ECMAScript arity of the Math members. A name of the f64 family, which has no WGSL signature, must take the signatures WGSL gives the type it stands in for (f64(x) as f32(x), vecNf64 as WGSL’s vector constructors), and a further signature of one is a new name under Rule 2.2.

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

근거

an argument shape Tint refuses should be refused at the source line, with the splat or the cast to write; and a signature is a spelling, so an overload that no WGSL form has is a spelling from nowhere (§2.1).

출처

Numeric Built-in Functions; Value Constructor Built-in Functions for the scalar and vector constructor forms; surface §10 (#57), §39.

검증 방식

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

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

TS8036 MATH_ARGUMENT and src/compiler/ts/lower/math-args.ts, whose rule for a name with SUPPORTED core.def rows is derived from those rows (0017); TS8019 for f64(a, b) (f64() expects 1 argument.) and surface-names.test.ts (the f64 family declares only the constructor forms WGSL gives the type it stands in for, the compiler refuses a second argument to f64).

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

설명하는 절

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

적용하는 오류 코드

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

TS8019 ARITY_MISMATCH
호출이나 생성자에서 인자, 요소, 필드의 개수가 맞지 않습니다.
TS8036 MATH_ARGUMENT
시그니처가 받지 않는 인자로 수학 내장 함수를 부릅니다. 모양이 맞아야 하는 두 값(dot(vec3, vec2)), 내장 함수에 해당 형태가 없는 요소 종류(정수 벡터의 sin), 벡터가 와야 할 곳의 스칼라(normalize(s)), 타입이 잘못된 계수, 지수, 오프셋, 개수가 그렇습니다. 메시지는 문제의 인자와, 짧게 고칠 수 있으면 방법을 알려 줍니다. 스칼라를 펼치거나, 한쪽을 변환하거나, 벡터 크기를 맞춥니다.

함께 보기

소스

커밋 af54ddad5의 규칙 원문:

이 페이지 편집 문제 보고