Skip to content

feat(stdlib): add strconv module (#1603)#1608

Merged
SchoolyB merged 19 commits intomainfrom
dev
May 4, 2026
Merged

feat(stdlib): add strconv module (#1603)#1608
SchoolyB merged 19 commits intomainfrom
dev

Conversation

@SchoolyB
Copy link
Copy Markdown
Owner

@SchoolyB SchoolyB commented May 4, 2026

Summary

  • Adds strconv stdlib module with 10 functions for string/type conversions
  • Fallible to_int, to_uint, to_float, to_bool — return (T, Error) via multi-var destructuring, or panic on single-var assignment
  • from_int, from_uint, from_float, from_bool — type-to-string (never fail)
  • is_numeric, is_integer — string query helpers
  • to_int and to_uint accept optional base parameter (default 10, valid range 2–36)
  • Module constants: BASE_2, BASE_8, BASE_10, BASE_16, BASE_36
  • Compile-time E5009 error for invalid literal base values; runtime panic/error for invalid variable base values

Bug fixes

  • fix(typechecker): suppress false W1002 warnings for sub-file imports
  • fix(typechecker): allow type names in size_of while rejecting bare builtin functions
  • fix(parser): replace uppercase heuristic with struct name prescan
  • fix(parser): suppress struct literal parsing on RHS of comparisons
  • fix(typechecker): reject bare builtin names used as values
  • fix(typechecker): enforce private access, reject nonexistent struct functions, catch struct type mismatches (bug: struct function validation gaps — private access, nonexistent calls, struct type mismatch #1599)

mvanhorn and others added 18 commits May 4, 2026 08:38
Adds --quiet/-q and --no-color flag support to `ez watch`, mirroring the pattern already used by `ez build` and `ez check` (cmd/ez/commands.go:440-450).

In runWatch, build a compilerArgs slice from cmd.Flags() and plumb it
through watchFile, watchDirectory, and executeFile so each compiler
invocation on file changes receives the same flags.

Closes #1573

Co-authored-by: Matt Van Horn <[email protected]>
Closes #1569.

The repo had no .github/ISSUE_TEMPLATE/ directory, so issue authors hit
an empty form and the bug-report template documented in CONTRIBUTING.md
had no automatic enforcement at filing time.

Adds three YAML issue forms under .github/ISSUE_TEMPLATE/:

- bug_report.yml: title prefix 'bug: ', severity dropdown matching
  CONTRIBUTING.md (Crash / Incorrect output / Misleading error /
  Cosmetic), required fields for ez report output, summary,
  reproduction (.ez snippet), expected, actual, plus optional
  where-to-look and related sections - mirrors the markdown template
  in CONTRIBUTING.md so the form output reads cleanly when triaged.

- feature_request.yml: title prefix 'feat: ', required fields for
  description, use case, alternatives considered, plus an optional
  example section.

- config.yml: disables blank issues and points readers at STANDARD.md
  and CONTRIBUTING.md as the first stop before filing.

All three pass yaml.safe_load.

Co-authored-by: Matt Van Horn <[email protected]>
Adds fallible string-to-type conversions (to_int, to_uint, to_float,
to_bool) returning (T, Error), type-to-string conversions (from_int,
from_uint, from_float, from_bool), and query functions (is_numeric,
is_integer). Panicking versions used for single-var assignment,
_result versions for multi-var destructuring.
…s) (#1603)

Add ez_strconv.c to RT_SRC in Makefile so it's linked into libezrt.a.
Add EzResult_bool include guard to prevent redefinition between ez_io.h
and ez_strconv.h. Register strconv to_X functions in fallible_stdlib and
fallible_type_table so multi-var destructuring works.
Adds pass tests for all 10 strconv functions: basic conversions
(strconv_c.ez, 15 assertions) and multi-var result destructuring
(strconv_result_variants.ez, 10 assertions). Updates TESTING.md
stdlib count from 46 to 48.
Adds optional second parameter (default 10) for specifying conversion
base (2-36). Adds module constants BASE_2, BASE_8, BASE_10, BASE_16,
BASE_36 accessible via strconv.BASE_X or bare via 'using'. Adds
compile-time E5009 error when a literal base outside [2,36] is passed.
Adds pass test for base conversion (11 assertions covering raw int
bases, all 5 constants, default base, and multi-var with base). Adds
fail test for E5009 invalid base compile-time error. Updates TESTING.md
counts (stdlib 49, fail/errors 580).
Adds runtime panic tests for invalid inputs: to_int with non-numeric
string, to_uint with negative, to_float with non-numeric, to_bool with
invalid string, and to_int with invalid base via variable. Also adds
runtime base validation to panicking and result variants of to_int/
to_uint. Updates fail/errors count to 585.
Documents all strconv functions, constants, parameter rules, and
behavior (panic vs error return). Covers valid base range, to_bool
accepted values, to_uint negative rejection, is_numeric/is_integer
semantics, and the single-var vs multi-var destructuring distinction.
@github-actions github-actions Bot added documentation Improvements or additions to documentation parser Related to parsing and AST construction typechecker Related to type checking and validation stdlib General standard library issues tests Related to unit tests or test infrastructure error-messages Related to improving error messages cli Command-line interface related ezc EZC compiler tool (EZ → C → native binary) labels May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Command-line interface related documentation Improvements or additions to documentation error-messages Related to improving error messages ezc EZC compiler tool (EZ → C → native binary) parser Related to parsing and AST construction stdlib General standard library issues tests Related to unit tests or test infrastructure typechecker Related to type checking and validation

Projects

None yet

2 participants