Rule 5.3
On this page

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 (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:

Error codes that enforce it

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

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), 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

Source

The rule at commit af54ddad5:

Edit this page Report a problem