Skip to content

test(phel): mark lenient core-fn divergences (suite green under Phel)#900

Closed
Chemaclass wants to merge 4 commits into
jank-lang:mainfrom
phel-lang:test/phel-divergences-batch
Closed

test(phel): mark lenient core-fn divergences (suite green under Phel)#900
Chemaclass wants to merge 4 commits into
jank-lang:mainfrom
phel-lang:test/phel-divergences-batch

Conversation

@Chemaclass

Copy link
Copy Markdown
Contributor

What

Adds :phel reader-conditional branches across 71 core-test namespaces so the suite runs 0 failures under Phel (was 209).

Phel is intentionally lenient where Clojure throws on bad-type input (nil-punning DX): predicates, arithmetic, and collection fns return a value (nil/false/0/identity) or coerce the argument instead of throwing. Each :phel branch asserts Phel's actual behavior, with a ;; comment documenting the divergence, mirroring the existing :cljs/:lpy/:cljr stance and the prior parse-* / string-strict divergence commits (#16, #18).

Other dialects' branches (:default/:clj/:cljs/:lpy/:cljr) are untouched — every restructured assertion keeps its original form under :default.

Categories marked

  • Throw → lenient return: key/val/keys/vals/peek/empty?/not-empty/realized?/min-key/select-keys/descendants/contains? etc. return nil/false instead of throwing.
  • Numeric coercion / IEEE-754: even?/odd?/zero?/pos?/neg?/</<=/>/>=/quot/rem/mod/min/max coerce nil→0 or follow PHP/IEEE float semantics instead of throwing.
  • 64-bit ints: +/-/*///int/long/byte silently promote on overflow (no BigInt throw).
  • char-as-string: \a is a 1-char string, so map/count/reverse/fnext/ffirst/set/last treat it as a seqable.
  • transient leniency: persistent ops on transients and *! after persistent! don't throw (see flags below).
  • stale marker dropped: repeatedly mid-failure now matches :default.

Notes for Phel-side follow-up (flagged, not blocking)

Marked as :phel to keep the suite green, but worth deciding whether Phel should tighten:

  • case with no matching clause and no default returns nil instead of erroring (arguable semantic gap).
  • transient/persistent boundary not enforced (persistent ops mutate transients silently).
  • Some bad-input paths still throw but leak raw PHP messages (SequenceGenerator::toIterable() TypeError, is_nan() deprecation) rather than clean Phel errors.

Result

Passed: 5473
Failed: 0
Error: 0

Chemaclass and others added 4 commits May 29, 2026 14:52
Phel's parse-long / parse-double / parse-boolean / parse-uuid intentionally
return nil for non-string (or unparseable) input instead of throwing, so they
chain in when/if-let without guarding. Add :phel branches to the exception
blocks asserting nil-return instead of p/thrown?, documenting the difference.
Other dialects are unaffected (they fall through to their existing branches).
v0.40.0 release predates the phel.test/assert-expr signature change
(arg order flipped to [message form], dispatch on 2nd arg) that the
suite's portability p/thrown? shim depends on, so the tag fails to
compile string/core tests. Pin dev-main to match the nightly CI target.
Phel's string functions are strict: a non-string argument throws instead of
being coerced via str/toString (the JVM :default behaviour). Add :phel
branches asserting the throw for upper-case / lower-case / capitalize /
starts-with? / ends-with? (mirroring the :cljs/:lpy/:cljr stance). blank?
gets a :phel branch for \space, which Phel reads as the space string " "
(blank? => true) rather than a character type.
Phel is intentionally lenient where Clojure throws on bad-type input
(nil-punning DX): predicates/arith/collection fns return a value
(nil/false/0/identity) or coerce instead of throwing. Add :phel reader
conditional branches asserting Phel's actual behavior, mirroring the
existing :cljs/:lpy/:cljr stance and the parse-*/string divergence
commits. Other dialects' branches are untouched.

Also drop a stale :phel marker in repeatedly (Phel now matches :default
for mid-failure side effects).

Brings the phel run of the suite to 0 failures.
@Chemaclass Chemaclass closed this May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant