Skip to content

v0.8.1 — method contracts for external classes

Choose a tag to compare

@tiagoschmitt tiagoschmitt released this 17 Aug 01:36
· 30 commits to main since this release

declare(Type.prototype.method) contracts now match x.method(y) call sites — @theoremts/contracts-decimal works end to end. The receiver binds as the first contract parameter; pure contracts (ensures(output() === E)) inline as ground substitutions, including inside quantifier bodies and the call-site checker; impure ones route through the memoized modular __ret machinery. Constructor contracts (declare(X, ...)) are checked at new X(...) sites.

Also: contract packages auto-discovered from @theoremts/contracts-* in the CLI and the ts-plugin (plus src/**/*.contracts.ts); enclosing requires reach call sites inside callbacks (shadowing-aware); positional check/assume route through the method-contract rewriter; ternary path conditions survive method-call guards; last-segment callee matching is arity-gated; native namespaces (Math.*) are never hijacked.

Battle-tested by dogfooding on a production codebase, where a call-site unit guard refuted a real rate-vs-percent unit mismatch with a counterexample.

312 core tests.