Skip to content

Print bool as the language's own literals: true/false - #19

Merged
yunabe merged 1 commit into
mainfrom
claude/bool-lowercase
Sep 3, 2026
Merged

Print bool as the language's own literals: true/false#19
yunabe merged 1 commit into
mainfrom
claude/bool-lowercase

Conversation

@yunabe

@yunabe yunabe commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Summary

Settles the open question tracked since #12: print(true) and string(true) now produce true/false — Arith's own literal spellings — instead of .NET's True/False, which matched neither the language's syntax nor the (case-insensitive, canonically lowercase) input accepted by typed main parameters. string(flag) == "true" and argument round-trips now behave intuitively.

  • Spec: §7 states that a bool converts to "true" or "false"; §10.1 now defines print as printing the string(value) conversion, with the bool rule called out.
  • Lowering: the shared convert-to-string helper replaces the Boolean.ToString() instance call (and its temp local) with a two-arm ldstr branch — three instructions, using the branch machinery from Add control flow: if/while/for, comparisons, logical ops, definite return #14. The now-unused Boolean::ToString MemberRef is gone.
  • Tests: e2e expectations flipped to lowercase in seven places (value-kind sweep, short-circuit, NaN comparisons, string equality ×2, conversions, bool argument echo); NaN float formatting is unchanged.

dotnet test: 405 passed / 1 skipped.

🤖 Generated with Claude Code

Settles the open question from the emitter PR: print(bool) and
string(bool) now produce "true"/"false" — Arith's literal spellings —
instead of .NET's "True"/"False", which matched neither the language
nor the case-insensitive lowercase input accepted by typed main
parameters. LANGUAGE_SPEC sections 7 and 10.1 state the rule, and
print is defined as printing the string(value) conversion.

The lowering replaces Boolean.ToString with a two-arm ldstr branch in
the shared convert-to-string helper (the temp local is no longer
needed for bool); e2e expectations updated across the suite.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@yunabe
yunabe merged commit 0edae2d into main Sep 3, 2026
1 check passed
@yunabe
yunabe deleted the claude/bool-lowercase branch September 3, 2026 13:37
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