Files
scriptc/tests/diagnostics/date-union-fences.ts
Chris Tateandsensei-woo e5c875bd97 Support Date instance lowering (#101)
* Support Date instance lowering

- Lower read-only Date values and constructors through the C and LLVM backends.

- Add portable calendar helpers, differential coverage, and documented surface contracts.

- Fence unsupported mutation, identity, locale, and component-constructor forms.

Co-authored-by: sensei-woo <sensei-woo@users.noreply.github.com>

* Fix Date exception and timezone semantics

* fix: harden Date lowering edge cases

* fix Date lowering edge cases

* Fix Date union fences and offset clipping

---------

Co-authored-by: sensei-woo <sensei-woo@users.noreply.github.com>
2026-08-08 23:17:58 -05:00

23 lines
598 B
TypeScript

// Compiler-synthesized `T | undefined` slots must observe the same Date
// union fence as source-written unions. Each construct below used to reach
// IR validation as an SC9001 internal compiler error.
function defaultDate(value: Date = new Date(0)): number {
return value.getTime();
}
defaultDate();
function* dates(): Generator<Date, void, unknown> {
yield new Date(0);
}
for (const value of dates()) console.log(value.getTime());
class DeferredDate {
value!: Date;
initialize(): void {
this.value = new Date(0);
}
}
const deferred = new DeferredDate();
deferred.initialize();