Rule 4.6
Chapter 4, Types Test
number and boolean must not be written as shader types; a number on the GPU has a width, and the boolean is spelled bool.
The rule text and the parts under it are the compiler's own English, as the design document writes them.
Rationale
an f32, an i32, and a u32 are three types with three layouts, and number names none of them.
Derives from
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:
TS8002 UNKNOWN_TYPE (A number on the GPU has a width. Write f32 for a float, i32 or u32 for an integer.; TypeShade spells the boolean "bool".), beside the last row of the surface §28 table.
The files that verify it at commit 26de7be8, each at the first line that names the rule:
Explained in
The sections of the surface document that explain this rule, at commit 26de7be8:
Error codes that enforce it
The diagnostic codes the rule names under Enforced by, or whose registry text names the rule:
-
TS8002UNKNOWN_TYPE - A type name nothing declares, said once for the file wherever it is written (a parameter, a claim, a type argument,
B<vec3<Foo>>included, an alias, animplementsclause, the base a class or an interface extends, a body no call lowers), a type the library declares for TypeScript alone (Number) where the file declares none of its name, or a type this surface does not take in a position the mapper reads (Rule 2.1).
See also
- Rule 4.5 Test
- Rule 4.7 Test
- Design rules
- Error codes
Source
The rule at commit 26de7be8:
docs/language-design.md:307(the design document)reqs/rules/RULE-0406.md(its traceability item)