규칙 8.9
이 페이지에서

규칙 8.9

8장, 함수와 진입점 테스트

Method dispatch must be static, and a generic function or class must be compiled once per set of type arguments the program uses (Rule 3.9). A derived class value may occupy a base-typed position when its base view is proved read-only and dispatch-equivalent: every base-visible method or accessor has the same body on the concrete class, no receiver writes or receiver escape are lost, and the projected fields cannot observably change through an alias after construction. The proof is conservative across the compiled source; unknown receivers and unproved alias writes do not establish safety. Arguments, initializers, assignments, returns and contextual composite elements use the same conversion. A generated function takes the concrete value once and constructs its base representation, preserving effects and source evaluation order. A view that needs runtime override selection or receiver retention remains refused with the concrete type to keep; no general dynamic-dispatch restriction is imposed by WGSL itself. A class with no instance fields remains a constructible value, including method-only, static-only, inherited, mixin and generic classes. Its authored field list remains empty; GPU lowering provides an internal carrier without adding source members or inherited fields. A body a class inherits is compiled again for that class; what fails only there (a call that takes the base, a static the class does not have) must be refused when a function that is not a class’s own reaches it through calls, and must not be when nothing does, the body being dropped with every function that calls it.

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

근거

this representation settles generic arguments and concrete receiver classes during compilation. A read-only base projection is accepted only when it preserves that receiver’s behavior; a value requiring runtime selection needs a retained concrete representation and generated dispatch.

출처

Functions (“each user-defined function only has one overload”); surface §26, §30, §32 (design #92).

검증 방식

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

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

TS8035 CLASS_MEMBER and examples/generic-class.shade.ts; src/compiler/ts/class-syntax.test.ts for a body a class inherits that fails for it alone, said when a call reaches it and dropped when none does. Read-only base views and unsafe overrides, accessors, receiver writes and alias mutation are pinned by src/compiler/ts/class-upcasts.test.ts; journeys/class-upcasts/ holds the packed package’s material constructor and factory evaluation order to independent JavaScript.

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

설명하는 절

커밋 c66579bf의 표면 문서에서 이 규칙을 설명하는 절입니다.

적용하는 오류 코드

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

TS8035 CLASS_MEMBER
A class member shape the surface does not take, or a use of a member the class rules refuse, and a new that builds no class (Rule 8.13).

함께 보기

소스

커밋 c66579bf의 규칙 원문:

이 페이지 편집 문제 보고