From 296d2e5b4e9693ce7cfe4b143d6bd1042db55a39 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Thu, 18 Jun 2026 03:03:10 -0600 Subject: [PATCH] test: add object field YESNO positive typecheck fixture --- CHANGELOG.md | 5 +++++ docs/ADVANCED_STATIC_TYPING.md | 2 +- docs/CURRENT_STATUS.md | 2 +- docs/ROADMAP.md | 2 +- tests/typecheck_object_field_yesno_good.claro | 6 ++++++ tools/validate_typecheck_diagnostics.py | 1 + 6 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 tests/typecheck_object_field_yesno_good.claro diff --git a/CHANGELOG.md b/CHANGELOG.md index b8ef2d1..a1ebe6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v1.18.26-dev object field YESNO positive validation + +- Added a focused positive `claro typecheck` fixture for direct object-field assignment with a YESNO field: `NEW Player player` followed by `SET player.ready YES` when the class declares `HAS ready YESNO`. +- Wired the YESNO object-field fixture into both the typecheck diagnostics validator and `claro validate`, complementing the existing NUMBER/TEXT positive fixtures and wrong-type field diagnostic fixture. + ## v1.18.26-dev object field TEXT positive validation - Added a focused positive `claro typecheck` fixture for direct object-field assignment with a TEXT field: `NEW Player player` followed by `SET player.name "Ada"` when the class declares `HAS name TEXT`. diff --git a/docs/ADVANCED_STATIC_TYPING.md b/docs/ADVANCED_STATIC_TYPING.md index 498cc6e..99d4ef6 100644 --- a/docs/ADVANCED_STATIC_TYPING.md +++ b/docs/ADVANCED_STATIC_TYPING.md @@ -150,7 +150,7 @@ Output: Type mismatch for field player.score: expected NUMBER, but this value looks like TEXT. ``` -Both sides of this narrow field foundation are covered by validation: `tests/typecheck_object_field_good.claro` checks that `SET player.score 10` is accepted for a `HAS score NUMBER` field, `tests/typecheck_object_field_text_good.claro` checks that `SET player.name "Ada"` is accepted for a `HAS name TEXT` field, and `tests/typecheck_object_field_bad.claro` checks the friendly wrong-type diagnostic. +Both sides of this narrow field foundation are covered by validation: `tests/typecheck_object_field_good.claro` checks that `SET player.score 10` is accepted for a `HAS score NUMBER` field, `tests/typecheck_object_field_text_good.claro` checks that `SET player.name "Ada"` is accepted for a `HAS name TEXT` field, `tests/typecheck_object_field_yesno_good.claro` checks that `SET player.ready YES` is accepted for a `HAS ready YESNO` field, and `tests/typecheck_object_field_bad.claro` checks the friendly wrong-type diagnostic. This slice is intentionally small: it covers direct `NEW Class object` plus `SET object.field value` cases in one file. Broader object flows, aliases, method return checks, and richer object signatures remain future work. diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.md index 79df6a1..5d6620a 100644 --- a/docs/CURRENT_STATUS.md +++ b/docs/CURRENT_STATUS.md @@ -53,7 +53,7 @@ Ready now: - `TYPE OF` and `CHECK TYPE` - typed list/map checks through `claro typecheck` - a narrow function/method argument check: `CHECK TYPE parameter IS TYPE` inside a function or simple object method lets `claro typecheck` accept correct checked calls and catch mismatched `DO`, `CALL ... WITH`, and `DO object.method ...` arguments -- a narrow object-field assignment check for simple `NEW Class object` plus direct `SET object.field value` cases when the class declares `HAS field TYPE`; validation now covers correct NUMBER and TEXT direct assignments plus a wrong-type diagnostic +- a narrow object-field assignment check for simple `NEW Class object` plus direct `SET object.field value` cases when the class declares `HAS field TYPE`; validation now covers correct NUMBER, TEXT, and YESNO direct assignments plus a wrong-type diagnostic Still needed: - richer typed function signatures and return values diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 61baaca..22219ae 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -31,7 +31,7 @@ See `CURRENT_STATUS.md` for the detailed feature matrix. 1. Keep beginner-facing docs current and separate from historical release notes. 2. Keep examples aligned with the modern simple syntax (`END`, `DO`, short `SET`, short `ASK`) while documenting older compatibility forms separately. -3. Expand validation around typecheck diagnostics and package/networking safety. Current object-method parameter validation covers one correct `DO object.method ...` call and one wrong-type diagnostic; object-field validation covers correct NUMBER and TEXT direct `SET object.field value` assignments plus one wrong-type direct assignment after `NEW Class object`. +3. Expand validation around typecheck diagnostics and package/networking safety. Current object-method parameter validation covers one correct `DO object.method ...` call and one wrong-type diagnostic; object-field validation covers correct NUMBER, TEXT, and YESNO direct `SET object.field value` assignments plus one wrong-type direct assignment after `NEW Class object`. 4. Add small examples for each foundation feature before adding bigger syntax. ## Complete-platform milestones diff --git a/tests/typecheck_object_field_yesno_good.claro b/tests/typecheck_object_field_yesno_good.claro new file mode 100644 index 0000000..a44ab1c --- /dev/null +++ b/tests/typecheck_object_field_yesno_good.claro @@ -0,0 +1,6 @@ +CLASS Player + HAS ready YESNO +END + +NEW Player player +SET player.ready YES diff --git a/tools/validate_typecheck_diagnostics.py b/tools/validate_typecheck_diagnostics.py index bfb6d28..0cda434 100644 --- a/tools/validate_typecheck_diagnostics.py +++ b/tools/validate_typecheck_diagnostics.py @@ -37,6 +37,7 @@ EXPECTED_OK = [ "tests/typecheck_method_good.claro", "tests/typecheck_object_field_good.claro", "tests/typecheck_object_field_text_good.claro", + "tests/typecheck_object_field_yesno_good.claro", "tests/37_object_field_types.claro", ]