Rule 2.3
Chapter 2, Sources of the surface Test
A value sometimes has to cross between a representation the compiler chose and one the target has: an f64 and the two f32 halves that carry it across an interface of f32.
The compiler must either perform the bridge silently or refuse the program in one sentence naming an ordinary remedy.
A spelling of the bridge, under any name, must not be a third option.
The rule text and the parts under it are the compiler's own English, as the design document writes them.
Rationale
the two honest answers to “the target cannot take this as written” are to make it work or to say what to write instead; a third spelling the author has to learn is neither.
Derives from
the same section of PR #166; the roadmap’s first rule, “ordinary TypeScript first”.
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:
TS8038 F64_ENTRY_IO(src/compiler/ts/lower/function.ts, PR #166) for anf64on an entry’s@locationparameter, on an entry I/O struct field, or on an entry’s return, one sentence that namesf32(x)and the uniform or storage binding as the two remedies (surface §39), pinned bysrc/compiler/ts/f64-types.test.ts;- a
TS8003that names no remedy, for anf64passed, returned, or assigned where anf32is declared (Appendix B); - the surface-names test, which catches a spelling of the bridge that is a pre-emit id, a second signature of
f64, or a non-constructor signature of avecNf64, and the front end, which refuses a call of one; - review, for a spelling under a new id, which none of the cases above catches.
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:
-
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.
-
TS8038F64_ENTRY_IO - An emulated double (
f64, avec64) on an entry's IO boundary — a@locationparameter, a@locationfield of an IO struct, or an entry's return.
See also
- Rule 2.2 Test
- Rule 2.4 Test
- Design rules
- Error codes
Source
The rule at commit 26de7be8:
docs/language-design.md:118(the design document)reqs/rules/RULE-0203.md(its traceability item)