Files
scriptc/tests/diagnostics/dynamic-surface.ts
Chris Tate bc2cd2b7d1 Support Number.toFixed statically
- Lower Number.prototype.toFixed through the compiler IR and native backends.
- Match JavaScript rounding, range errors, and numeric edge cases in the runtime.
- Add differential coverage and update surface metadata and diagnostics.
2026-07-26 18:43:53 -05:00

16 lines
787 B
TypeScript

// The island-backed ambient surface (Math beyond the static members,
// number methods, string-pattern replace/at, the Number statics, ...)
// typechecks against real static types but executes in the embedded
// engine: in a static build every use site is its own SC2012 naming the
// flag — never an ICE, never a link error. (Math.floor/abs/round and the
// ask-4 wholeness-discharge pair Math.trunc/ceil, .split(string), the
// trim/pad variants, parseInt, isNaN, and the global parseFloat/isFinite
// over exactly-typed arguments compile statically now and no longer
// appear here.)
const up = Math.sqrt(2);
const tau = Math.PI * 2;
const price = (19.99).toPrecision(4);
const swapped = "banana".replace("an", "AN");
const ch = "hello".at(0);
const n = Number.parseFloat("3.14");