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 26de7be8, 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:
-
TS8003TYPE_MISMATCH - Two types that do not fit where they meet (an operator, a condition, a declaration, a return or an argument), or a constant the compiler folds that WGSL refuses: a shift amount past 31, a divisor of 0, clamp bounds that cross or an f32 past its range.
See also
- Rule 5.2 Test
- Rule 5.4 Test
- Design rules
- Error codes
Source
The rule at commit 26de7be8:
docs/language-design.md:357(the design document)reqs/rules/RULE-0503.md(its traceability item)