---
title: "Rule 5.3: Literals and typing, a TypeShade design rule"
description: "Rule 5.3 of the TypeShade language design, in Literals and typing. There is no implicit conversion between concrete types; an i32 beside a u32…"
url: https://typeshade.dev/reference/rules/5-3/
language: en
---

# Rule 5.3

Chapter 5, Literals and typing Test

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.

The rule text and the parts under it are the compiler's own English, as the design document writes them.

## Rationale

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

## Derives from

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

## How it is verified

Checked by a test. A test, a gate script or a CI workflow names this rule, and the traceability check fails when a file listed below stops naming it.

Where the rule says the compiler enforces it:

`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`.

The files that verify it at commit af54ddad5, each at the first line that names the rule:

- [`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)

## Error codes that enforce it

The diagnostic codes the rule names under Enforced by, or whose registry text names the rule:

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

Two types that do not fit where they meet (an operator, a condition, a declaration, a return or an argument), a read of an optional value (`T | undefined`, `T | null` or `T | null | undefined`) that no test narrowed ([Rule 7.10](https://typeshade.dev/reference/rules/7-10/)), or a constant the compiler folds that WGSL refuses: a shift amount past 31, a divisor of 0, clamp bounds that cross, an `f32` past its range or a builtin call outside its domain, such as `Math.pow(-2., 2.)`.

## See also

- [Rule 5.2](https://typeshade.dev/reference/rules/5-2/) Test
- [Rule 5.4](https://typeshade.dev/reference/rules/5-4/) Test
- [Design rules](https://typeshade.dev/reference/rules/)
- [Error codes](https://typeshade.dev/reference/errors/)

## Source

The rule at commit af54ddad5:

- [`docs/language-design.md:438`](https://github.com/typeshade/typeshade/blob/af54ddad5/docs/language-design.md#L438) (the design document)
- [`reqs/rules/RULE-0503.md`](https://github.com/typeshade/typeshade/blob/af54ddad5/reqs/rules/RULE-0503.md) (its traceability item)
