TS8053
이 페이지에서

TS8053

프런트엔드 코드 INT_LITERAL_DEPRECATION

A deprecation warning, not an error: an undecided integer-written declaration still defaults to f32 and will default to i32 (§13).

레지스트리 설명과 컴파일러 메시지는 컴파일러 원문이라 한국어 페이지에서도 영어로 둡니다.

발생 조건

A deprecation warning, not an error: an undecided integer-written declaration still defaults to f32 and will default to i32 (§13). A declared use that already establishes an integer type carries no warning. Reported only when the caller asks for it with deprecations: true; the compiler's warning does not change the chosen type.

예제

example.shade.ts
"use typeshade"
@fragment
export function main(@location(0) uv: vec2): vec4 {
const k = 2
return vec4(uv * k, 0., 1.)
}

이 경고를 켜는 옵션인 { deprecations: true }를 주고 컴파일했습니다.

빌드할 때 고정된 컴파일러로 이 프로그램을 컴파일하면 다음 진단이 나옵니다.

TS8053 warning, 5행: "k" is written as an integer and types as f32 today; it will type as i32 (§13, #148). Write "k = 2." to keep f32, or leave it and take i32.

고치는 법

같은 프로그램을 고친 모습입니다. 진단 없이 컴파일됩니다.

example.shade.ts
"use typeshade"
@fragment
export function main(@location(0) uv: vec2): vec4 {
const k = 2.
return vec4(uv * k, 0., 1.)
}

함께 보기

소스

커밋 c66579bf에서 컴파일러가 이 코드를 내는 곳입니다. 파일마다 한 줄씩 적었습니다.

이 페이지 편집 문제 보고