From 5cdb88b30acab9230a882a8e1117efaecf295a21 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Sat, 19 Sep 2026 22:22:53 +0000 Subject: [PATCH] test: cover complete TYPE OF syntax --- docs/CURRENT_STATUS.md | 1 + docs/ROADMAP.md | 1 + tests/typecheck_type_of_good.claro | 2 ++ tools/validate_typecheck_diagnostics.py | 1 + 4 files changed, 5 insertions(+) create mode 100644 tests/typecheck_type_of_good.claro diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.md index a4a0f73..f603a16 100644 --- a/docs/CURRENT_STATUS.md +++ b/docs/CURRENT_STATUS.md @@ -62,6 +62,7 @@ Ready now: - `TYPE OF` reports a direct repair hint when the learner forgets `AS`, for example `TYPE OF score` suggests `TYPE OF score AS kind` - `TYPE OF` reports a direct repair hint when the learner forgets the expression before `AS`, for example `TYPE OF AS kind` reports `TYPE OF needs an expression before AS. Try: TYPE OF score AS kind.` - `TYPE OF` reports a direct repair hint when the learner forgets the result name after `AS`, for example `TYPE OF score AS` reports `TYPE OF needs a result name after AS. Try: TYPE OF score AS kind.` +- A valid `TYPE OF score AS kind` statement has a focused positive typecheck fixture, so the complete form is protected from diagnostic-only regression coverage. - `TYPE OF` rejects extra words after its result name with a direct repair hint, so `TYPE OF score AS kind extra` explains that only one result name belongs there; typed `TEACH ... RETURNS TYPE` declarations likewise reject extra words after the return type with a direct repair hint - typed `TEACH ... RETURNS` declarations reject a missing return type with a direct repair hint, such as `Function greet needs a return type after RETURNS. Add a type such as NUMBER.` The same diagnostic names the complete class and method, including compatibility `TAKES` / `LEARNED` methods: `Method Player.score needs a return type after RETURNS. Add a type such as NUMBER.` - typed list/map checks through `claro typecheck`, including a nested `LIST OF MAP` insertion example diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 5a21989..70e3582 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -81,6 +81,7 @@ Keep declared return types honest: `claro typecheck` now reports friendly diagno 8q.5. Keep `TYPE OF` declarations understandable: a missing `AS` now gets a direct repair hint with a complete `TYPE OF score AS kind` example. 8q.5.1. Keep `TYPE OF` declarations complete: a missing expression before `AS` now gets a direct repair hint with a complete `TYPE OF score AS kind` example. 8q.5.2. Keep `TYPE OF` declarations named: a missing result name after `AS` now gets a direct repair hint with a complete `TYPE OF score AS kind` example. +8q.5.3. Keep complete `TYPE OF` examples protected: the valid `TYPE OF score AS kind` form now has a positive fixture in the focused typecheck validation matrix. 8q.6. Keep `TYPE OF` declarations unambiguous: extra words after the result name now get a direct repair hint instead of being silently included in the variable name. 8q.7. Keep typed `TEACH` declarations unambiguous: extra words after a declared return type now get a direct repair hint instead of being treated as part of an unknown type. 8q.8. Keep typed `TEACH` declarations complete: a bare `RETURNS` now gets a direct repair hint naming the missing type and showing a supported example such as `NUMBER`. diff --git a/tests/typecheck_type_of_good.claro b/tests/typecheck_type_of_good.claro new file mode 100644 index 0000000..b2566ed --- /dev/null +++ b/tests/typecheck_type_of_good.claro @@ -0,0 +1,2 @@ +SET score NUMBER 10 +TYPE OF score AS kind diff --git a/tools/validate_typecheck_diagnostics.py b/tools/validate_typecheck_diagnostics.py index a50d11d..4db7a26 100644 --- a/tools/validate_typecheck_diagnostics.py +++ b/tools/validate_typecheck_diagnostics.py @@ -476,6 +476,7 @@ EXPECTED = { } EXPECTED_OK = [ + "tests/typecheck_type_of_good.claro", "tests/typecheck_function_good.claro", "tests/typecheck_function_return_good.claro", "tests/typecheck_function_compat_return_good.claro",