java.time Phase 2: Duration/Period, enums, ChronoUnit/Field machinery

Duration (ISO PT.. toString, between, full arithmetic), Period (between with
borrow, P.. toString, normalized), full Month/DayOfWeek enums (named constants,
print as their name — fixes the Phase-1 raw-jhost print), Year, YearMonth
(2020-02 toString, leap, atDay/atEndOfMonth), ChronoUnit (between/getDuration)
and ChronoField. The temporal machinery on the Phase-1 types now works with
ChronoUnit/ChronoField: (.plus t n DAYS), (.until t1 t2 unit), (.get/.getLong
t field), (.with t field v), (.isSupported ..), (.truncatedTo ..).

Analyzer: (. Class method args) with a class target lowers to a static call
(Class/method args) instead of mis-dispatching as an instance call on the arg
— matches JVM; needed by cljc.java-time.year. Seed re-minted; selfhost holds.

The Phase-2 cljc.java-time namespaces load; tick.core advances to a Phase-3
zone gap. 10 corpus rows certified vs JVM. make test + shakesmoke green, 0 new
divergences, data.json stays 138/139.
This commit is contained in:
Yogthos 2026-06-24 18:10:40 -04:00
parent c0561a8d14
commit e3c14e656c
5 changed files with 773 additions and 17 deletions

View file

@ -478,12 +478,23 @@
(defn- analyze-dot [ctx items env]
(when (< (count items) 3)
(throw (str "Malformed (. target member ...) form")))
(let [member (nth items 2)]
(let [target (nth items 1)
member (nth items 2)
;; (. Class method args*) with a class target is a static call —
;; equivalent to (Class/method args*). resolve-global tags a class
;; symbol :kind :class; a local of the same name shadows it.
class-target (when (and (form-sym? target)
(not (local? env (form-sym-name target))))
(let [r (resolve-global ctx target)]
(when (= :class (:kind r)) (:name r))))]
(cond
(and class-target (form-sym? member))
(invoke (host-static class-target (form-sym-name member))
(mapv #(analyze ctx % env) (drop 3 items)))
(form-sym? member)
{:op :host-call
:method (form-sym-name member)
:target (analyze ctx (nth items 1) env)
:target (analyze ctx target env)
:args (mapv #(analyze ctx % env) (drop 3 items))}
;; (. obj :kw) is a keyword lookup — invoke the keyword on the target.
(form-keyword? member)