---
title: "규칙 5.3: 리터럴과 타입 결정, TypeShade 셰이더 언어 설계 규칙과 그 근거, 출처, 검증 방식"
description: "TypeShade 언어 설계 규칙 5.3(리터럴과 타입 결정)입니다. There is no implicit conversion between concrete types; an i32 beside a u32…"
url: https://typeshade.dev/ko/reference/rules/5-3/
language: ko
---

# 규칙 5.3

5장, 리터럴과 타입 결정 테스트

There is no implicit conversion between concrete types; an `i32` beside a `u32`, or an integer beside a float, must be refused with the cast to write.

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

## 근거

WGSL has no implicit integer or int/float conversion, and a conversion the emitted text does not contain is one Tint refuses.

## 출처

[Conversion Rank](https://gpuweb.github.io/gpuweb/wgsl/#conversion-rank) (every rank between two concrete types is infinite).

## 검증 방식

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

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

`TS8003 TYPE_MISMATCH` with the text “WGSL has no implicit integer conversion. Cast one side” (`numeric.ts`), pinned by `src/compiler/ts/numeric.test.ts`.

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

- [`src/compiler/ts/local-numeric-inference.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/local-numeric-inference.test.ts#L1)
- [`src/compiler/ts/numeric.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/numeric.test.ts#L1)
- [`src/compiler/ts/numeric.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/numeric.ts#L1)
- [`src/compiler/ts/scalar-cast-type.test.ts:1`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/compiler/ts/scalar-cast-type.test.ts#L1)

## 적용하는 오류 코드

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

**[`TS8003`](https://typeshade.dev/ko/reference/errors/ts8003/) `TYPE_MISMATCH`**

연산자나 조건, 선언, 반환, 인자처럼 두 값이 만나는 자리에서 타입이 서로 맞지 않거나, 검사로 좁히지 않은 선택적 값(`T | undefined`, `T | null`, `T | null | undefined`)을 읽거나([규칙 7.10](https://typeshade.dev/ko/reference/rules/7-10/)), 컴파일러가 접는 상수를 WGSL이 거부합니다. 31을 넘는 시프트 양, 0인 제수, 서로 엇갈린 clamp 경계, 범위를 넘는 `f32` 값, `Math.pow(-2., 2.)`처럼 정의역 밖에서 부르는 내장 함수가 그렇습니다.

## 함께 보기

- [규칙 5.2](https://typeshade.dev/ko/reference/rules/5-2/) 테스트
- [규칙 5.4](https://typeshade.dev/ko/reference/rules/5-4/) 테스트
- [설계 규칙](https://typeshade.dev/ko/reference/rules/)
- [오류 코드](https://typeshade.dev/ko/reference/errors/)

## 소스

커밋 af54ddad5의 규칙 원문:

- [`docs/language-design.md:438`](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/language-design.md#L438) (설계 문서)
- [`reqs/rules/RULE-0503.md`](https://github.com/typeshade/typeshade/blob/af54ddad5/reqs/rules/RULE-0503.md) (추적 항목)
