오류 코드
코드 85개
컴파일러가 진단에 붙이는 코드를 모두 모았습니다. 커밋 26de7be8의 레지스트리 두 곳에서 읽어 왔습니다. "use typeshade" 프런트엔드의 코드가 47개, 그 아래 코어 IR 계층의 코드가 36개입니다.
49개 페이지에는 코드를 내는 프로그램과 그 프로그램을 고친 모습이 함께 실려 있습니다. 둘 다 빌드할 때 고정된 컴파일러로 컴파일하므로, 프로그램이 더는 그 코드를 내지 않거나 고친 프로그램에 진단이 남으면 빌드가 멈춥니다. 예제 태그가 붙은 행이 그런 페이지입니다.
레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.
프런트엔드 코드
TS80xx 코드는 프런트엔드의 TS_CODES에 들어 있습니다. "use typeshade" 파일은 IR을 만들기 전에 이 코드들로 먼저 검사받습니다.
파일
-
TS8001MISSING_DIRECTIVE예제 - TypeShade로 컴파일하는 파일에
"use typeshade"지시문이 아예 없습니다. -
TS8013HOST_STMT예제 - Host control flow and the JavaScript runtime forms no shader has:
await,yield, anasyncor generator function,try/catch/throw,for…in,var, a spread outside an object literal, and a template string. -
TS8014TOP_LEVEL예제 - 파일 최상위에 컴파일러가 선언으로 받을 수 없는 것이 있습니다. 선언이 아닌 문이거나, 거부하는 형태의 모듈 수준 선언입니다.
-
TS8030SYNTAX예제 - A TypeScript parse error (an unclosed parenthesis, a missing brace, an unexpected token) in a
"use typeshade"file, carried through as a TypeShade diagnostic so acompile()caller sees it without runningtsc. -
TS8050ENABLE_NAME예제 - A file-level
"enable <extension>";directive (§50) naming an extension outside the vocabulary the WGSL backend's capability profile carries a directive for (clip_distances,dual_source_blending,f16,primitive_index,subgroups). -
TS8072IMPORT예제 - An import the compiler does not follow (Rule 3.9, surface §68, proposals 0022 and 0024): a path that names no file or one this compile cannot read, a file that is not a shader module, a package no
node_modulesholds, a subpath a package'sexportsdoes not name, a package's name alone when it has noexports, a#specifier or one that is neither relative nor a package name, a name the module does not export, and the forms a shader module has no use for (a default import or export, an import that names nothing,import(...),require, a module namespace used as a value). -
TS8099UNSUPPORTED예제 UNSUPPORTED(TS8099) is the one deliberate exception to "sequential": it is the catch-all for a diagnostic whose site does not yet deserve its own code, so it stays parked past the sequential range instead of at its head.
타입과 이름
-
TS8002UNKNOWN_TYPE예제 - A type name nothing declares, said once for the file wherever it is written (a parameter, a claim, a type argument,
B<vec3<Foo>>included, an alias, animplementsclause, the base a class or an interface extends, a body no call lowers), a type the library declares for TypeScript alone (Number) where the file declares none of its name, or a type this surface does not take in a position the mapper reads (Rule 2.1). -
TS8003TYPE_MISMATCH예제 - 연산자나 조건, 선언, 반환, 인자처럼 두 값이 만나는 자리에서 타입이 서로 맞지 않거나, 컴파일러가 접는 상수를 WGSL이 거부합니다. 31을 넘는 시프트 양, 0인 제수, 서로 엇갈린 clamp 경계, 범위를 넘는 f32 값이 그렇습니다.
-
TS8005CONST_ASSIGN예제 const나 읽기 전용 리소스처럼 바뀔 수 없는 이름에 값을 대입합니다.-
TS8010STRUCT_FIELD예제 - An invalid struct field or declaration shape.
-
TS8016INDEX_OOB예제 - 상수 인덱스가 대상의 길이를 벗어납니다.
-
TS8018ASSIGN_TARGET예제 - An assignment or
++/--target that is not a writable place, such as a temporary or an input that has no writable value local. -
TS8022UNKNOWN_NAME예제 - Reference to a name TypeShade cannot resolve (identifier, struct field, or struct shape) that is not a function call (
UNKNOWN_FN) or a type name (UNKNOWN_TYPE), in a body a call lowers or in one no call lowers; a name the library declares for TypeScript's own use (Object,Math,Symbol), or the file declares as an enum, a namespace, a class or a type, read as a value says what it is. -
TS8023DUPLICATE_SYMBOL예제 - The same function, binding, module constant or struct name declared twice in one scope.
-
TS8053INT_LITERAL_DEPRECATION예제 - A deprecation warning, not an error: an undecided integer-written declaration still defaults to
f32and will default toi32(§13).
함수와 클래스
-
TS8004UNKNOWN_FN예제 - 파일이 선언하지도 가져오지도 않은 함수를 부릅니다.
-
TS8019ARITY_MISMATCH예제 - Wrong number of arguments, elements, or fields at a call or constructor site.
-
TS8020FUNCTION_SHAPE예제 - A function declaration or parameter shape TypeShade does not support (missing name or body, optional/rest/destructured parameter).
-
TS8021RETURN_SHAPE예제 - A
returnshape problem: barereturnwhere a value is required, or an entry function with no return type annotation that returns a value. -
TS8031RECURSION예제 - A call cycle: a function that reaches itself, directly or through other functions.
-
TS8035CLASS_MEMBER예제 - A class member shape the surface does not take, or a use of a member the class rules refuse, and a
newthat builds no class (Rule 8.13). -
TS8036MATH_ARGUMENT예제 - A math builtin called with arguments its signature does not take: two shapes that had to agree (
dot(vec3, vec2),clamp(v, 0., 1.)with a vectorv), an element kind the builtin has no form for (sinon an integer vector,mixon one), a scalar where a vector is due (normalize(s),crosson avec2),mix's factor orrefract's eta of the wrong shape,ldexp's exponent not an i32 ofx's shape, a bit offset or count that is not au32, ortranspose/determinanton a non-matrix.
제어 흐름
-
TS8006LOOP_BOUND예제 - 컴파일러가 종료를 증명할 수 없는
for루프입니다. 카운터를 경계와 비교하지 않거나, 본문이 경계를 씁니다. -
TS8007LOOP_INFINITE예제 - 끝나지 않는 것이 확실한 루프입니다.
break나return이 없는데 조건이true인while, 또는 카운터를 경계에서 멀어지게 하는 증가입니다. 조건은 그대로 썼든 상수만으로 계산했든 같습니다. -
TS8008LOOP_INDUCTION예제 for루프의 카운터가i32나u32타입의let하나가 아니거나, 갱신이 상수만큼 움직이지 않습니다.-
TS8009BREAK_OUTSIDE예제 - 감싸는 루프나
switch가 없는 곳에break를 썼습니다. -
TS8017SWITCH_CASE예제 - Invalid
switchcase: a label that is not an integer constant, does not fit the selector, or repeats another; an empty clause with no body below it to share (a trailing one, or one abovedefault:); a body whose end is reachable above a clause with a body, which TypeScript would run on into and WGSL does not (Rule 7.3); orcontinuein a switch no loop encloses. -
TS8034BARRIER_PLACEMENT예제 workgroupBarrier()/storageBarrier()somewhere a barrier cannot stand (§25): in a vertex or fragment entry, which has no workgroup; or as a value, since a barrier is a statement (roadmap 0.2 item 5).-
TS8052UNIFORMITY예제 - A call that needs uniform control flow —
textureSampleand the other implicit-LOD forms, the derivatives, a barrier, orworkgroupUniformLoad— reached under a condition that is not uniform across the invocations that run together (anif, aswitch, a loop's condition, the left side of&&or||, the condition of a?:WGSL writes as anif), or after areturn,breakorcontinuetaken under one (§54).
진입점과 입출력
-
TS8024BUILTIN_NAME예제 @builtin("...")names an id outside WGSL's builtin vocabulary (WgslBuiltinNameincore/sot.ts).-
TS8025BUILTIN_STAGE예제 - A
@builtin(...)id used as the wrong stage's input or output, e.g.frag_depthon a vertex return, orfront_facingon a vertex parameter. -
TS8026WORKGROUP_SHAPE예제 - A warning:
@compute([x, y, z])exceeds one of WebGPU's default compute limits (xandy256,z64, 256 invocations in all), so a device requested without raising that limit refuses the pipeline. -
TS8028ATTRIBUTE_NAME예제 - A decorator identifier outside the attribute vocabulary
"use typeshade"defines (@vertex,@fragment,@compute,@builtin,@location), e.g. a misspelled@vertx: without this, the decorated function or field just silently stops being an entry point or an I/O field. -
TS8029STRUCT_FIELD_MISSING_ATTR예제 - A field of a struct used as an entry function's parameter or return type carries neither
@builtin(...)nor@location(...): WGSL rejects an entry-IO struct member with no attribute, so this is caught at the front end instead of reaching the backend as invalid emitted WGSL. -
TS8037WORKGROUP_ARG예제 @compute(...)with an argument that is not an array literal of one to three whole numbers: an object, a bare number, an identifier, an empty or four-wide array.
리소스와 메모리
-
TS8032UNSIZED_ARRAY_LENGTH예제 .length, orarrayLength(x), on anarray<T>with noNthat is not in storage: auniform<array<T>>, a local, or a parameter.-
TS8033MODULE_VAR예제 - A module variable (
let x: workgroup<T>,let y: T = init, §24) declared or used where its address space forbids: aconstwith an address-space wrapper, aworkgroupvariable with an initializer, a type the space cannot hold (a texture, a runtime-sized array, an atomic in a per-invocation variable), an initializer that is not a constant, or aworkgroupvariable reached from a vertex or fragment entry (roadmap 0.2 item 5). -
TS8041TEXTURE_ARGUMENT예제 - A plain argument of a texture read that the target has no overload for: a coordinate or gradient of the wrong width for the texture's dim or of an element kind the read does not take (a sampled read is by normalised
f32, a texel fetch by wholei32/u32texel), a layer, mip level or sample index that is not an integer or is not a whole number of 0 or more, and alevel,biasordepth_refthat is not anf32. -
TS8051LAYOUT예제 - A buffer binding's store type breaks one of WGSL's host-shareable rules (§51), which a struct hides from the type map and the backend only meets as emitted text: a
bool, alone or in a vector, in auniformorstoragebinding, as a field, a runtime array's element or the whole type (type 'bool' cannot be used in address space 'uniform' as it is non-host-shareable, and the same ofvec3<bool>), a runtime-sizedarray<T>that is not its struct's last member, or a runtime-sized array in a uniform, whose type must be constructible.
에뮬레이션 배정밀도
-
TS8027MAT_UNSUPPORTED예제 - A non-square
matCxR<f64>: the fp64 pass carries one df64 body per dimension (DF64MatN, matmul, matvec, transpose), so only a square matrix of doubles lowers. -
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.
대상
-
TS8015BACKEND예제 - 프런트엔드가 받아들인 모듈을 백엔드가 출력하지 못하고 거부했습니다. 메시지는 백엔드가 쓴 그대로입니다.
-
TS8068RESERVED_NAME예제 - A declared name that a target reserves, checked on the name the emit actually carries:
halfas a struct field, which ANGLE answers with "Illegal use of reserved word" in generated text the author never wrote.
폐기된 번호
-
TS8011 - A gap (8011 and 8012 are retired) is never reused.
-
TS8012 - A gap (8011 and 8012 are retired) is never reused.
그 밖의 코드
-
TS8069MISPLACED_DIRECTIVE예제 - A
"use typeshade"directive after another top-level statement (Rule 3.1). -
TS8070KERNEL_LOOP_ON_CPU - A warning on a loop of a kernel function (Rule 8.22, surface §65, proposal 0013) that the independence proof refused: the loop runs on the CPU, and the message names the line and the author's names that stop it, and the remedy.
-
TS8071CONSOLE_NOT_RECORDED예제 - A warning under
compile(src, { console: 'gpu' }): aconsolecall the WGSL does not record, on the call, with the reason (a vertex entry reaches it, an argument has no fixed size or is not a value, the stage has no room for another storage buffer).
코어 코드
SDxxxx 코드는 typeshade/dev가 내보내는 CODES 카탈로그에 들어 있습니다. 코어 IR 계층은 fn() 빌더에서도 "use typeshade" 파일에서도 이 코드를 냅니다. 다만 같은 실수 가운데 상당수는 프런트엔드가 자기 코드로 먼저 거부합니다.
타입과 이름
-
SD0001 - matrix × vector size mismatch
-
SD0002 - binary op on mismatched vectors
-
SD0003 - arithmetic op on a bool operand
-
SD0004 - binary op on incompatible types
-
SD0005 - bitwise op requires a u32/i32 left operand
-
SD0006 - component access on a non-vector
-
SD0007 - vector component out of range
-
SD0008 - swizzle on a non-vector
-
SD0009 - .select() on a non-bool condition
-
SD0010 - select branches have differing types
-
SD0011 - matchExpr case type does not match the default
-
SD0015 - array-texture layer must be an integer
-
SD0116 - a scalar cast applied to a non-scalar value
-
SD0117 - a one-argument .at(i) on a node that is not an array
빌더 호출
-
SD0012 - statement sink not installed
-
SD0013 - no active builder
-
SD0113 - a fn whose body returns nothing at the TypeScript level returns a value at run time
-
SD0115 - a branch body returned a value, which a branch cannot carry out
리소스와 메모리
-
SD0014 - override (specialization constant) must be a WGSL scalar type
-
SD0016 - host-owned resource has a shape the target cannot spell
-
SD0114 - a variable a function reads has no declaration in the module
대상
-
SD0017 - literal cannot be spelled by the target
-
SD0020 - module validation failed
-
SD0030예제 - unsupported feature for this backend
에뮬레이션 배정밀도
-
SD0040 - f64 type leaked past fp64Lower into a backend emitter
-
SD0041 - unsupported operation on f64 operands
-
SD0042 - conflicting fp64 guard declaration
-
SD0043예제 - reserved fp64 name
-
SD0044 - f64 in an interpolated @location IO field
린트 규칙
-
SD0107 - assignment to an immutable 'let' binding
-
SD0108예제 - smoothstep with constant edge0 >= edge1 (undefined in GLSL ES)
-
SD0109 - a fragment-only builtin is reachable from a vertex or compute entry
-
SD0112 - a local name is declared twice in one function
이식형 커널
그 밖의 코드
-
SD0118 - grad cannot differentiate this function
번호 매기기
프런트엔드 레지스트리는 번호를 매기는 방식을 파일 머리 주석에 직접 적어 두었습니다.
Numbering: TS8 + a zero-padded sequential number, assigned in the order a code was added. A gap (8011 and 8012 are retired) is never reused. UNSUPPORTED (TS8099) is the one deliberate exception to "sequential": it is the catch-all for a diagnostic whose site does not yet deserve its own code, so it stays parked past the sequential range instead of at its head.
One more kind of gap exists from TS8039 to TS8067. While several sessions worked the issue list of #162 in parallel, each was given a BLOCK of codes to draw from, so two branches in flight at once could not claim one number twice. F64_ENTRY_IO (TS8038) is the last code in the sequential range; TEXTURE_ARGUMENT (TS8041) and RESERVED_NAME (TS8068) were assigned from blocks, and the numbers a block did not spend stay unspent. A block's unused codes stay unused, exactly as 8011 does — a gap is never reused.
Implements: Rule 3.7 (docs/language-design.md; traced in reqs/).