Rule 2.3
On this page

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 an f64 on an entry’s @location parameter, on an entry I/O struct field, or on an entry’s return, one sentence that names f32(x) and the uniform or storage binding as the two remedies (surface §39), pinned by src/compiler/ts/f64-types.test.ts;
  • a TS8003 that names no remedy, for an f64 passed, returned, or assigned where an f32 is 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 a vecNf64, 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:

TS8003 TYPE_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.
TS8038 F64_ENTRY_IO
An emulated double (f64, a vec64) on an entry's IO boundary — a @location parameter, a @location field of an IO struct, or an entry's return.

See also

Source

The rule at commit 26de7be8:

Edit this page Report a problem