Compare commits

...
226 Commits
Author SHA1 Message Date
Hermes Agent 9beb0e167e typecheck: diagnose missing TYPE OF expressions 2026-09-19 18:14:52 +00:00
Hermes Agent deb09cff8b test: cover compatibility complete branch returns 2026-09-19 16:09:48 +00:00
Hermes Agent 74edbdb10e test: cover compatibility branch returns 2026-09-19 14:06:32 +00:00
Hermes Agent 1bc11207ef test: cover compatibility function missing returns 2026-09-19 12:01:25 +00:00
Hermes Agent 30713c71c1 test: cover compatibility function multiplication returns 2026-09-19 09:57:07 +00:00
Hermes Agent 55b2f1c9f3 test: cover compatibility function division returns 2026-09-19 07:53:54 +00:00
Hermes Agent c8df657b63 test: cover compatibility function subtraction returns 2026-09-19 05:51:07 +00:00
Hermes Agent 229d1a7dbe test: cover compatibility function arithmetic returns 2026-09-19 03:47:22 +00:00
Hermes Agent 039da8159e test: cover unknown compatibility return expressions 2026-09-19 01:43:51 +00:00
Hermes Agent b79db4f25c test: cover empty compatibility function returns 2026-09-18 23:41:22 +00:00
Hermes Agent ede2e333fb test: cover compatibility function return tokens 2026-09-18 21:37:24 +00:00
Hermes Agent ea15117a1f test: cover extra return tokens in methods 2026-09-18 19:33:51 +00:00
Hermes Agent ebfa3aa52e typecheck: clarify extra return tokens 2026-09-18 17:31:17 +00:00
Hermes Agent 19b624482f test: cover empty compatibility method returns 2026-09-18 15:24:45 +00:00
Hermes Agent e17f450603 test: cover compatibility missing return types 2026-09-18 13:20:00 +00:00
Hermes Agent df3c57415d typecheck: identify methods missing return types 2026-09-18 11:16:47 +00:00
Hermes Agent 131211adef typecheck: diagnose missing return types 2026-09-18 09:12:58 +00:00
Hermes Agent da2bd5c2e8 typecheck: clarify extra return type tokens 2026-09-18 07:10:27 +00:00
Hermes Agent 3a9e3d0a8c typecheck: reject extra TYPE OF tokens 2026-09-18 05:05:35 +00:00
Hermes Agent 7f0d12ac59 typecheck: diagnose missing TYPE OF AS 2026-09-18 03:02:00 +00:00
Hermes Agent 053aa8aa55 typecheck: diagnose missing CHECK TYPE expression 2026-09-18 00:59:27 +00:00
Hermes Agent b59b240f0f typecheck: clarify missing CHECK TYPE expression 2026-09-17 22:54:48 +00:00
Hermes Agent cd92a04303 typecheck: clarify missing expected type 2026-09-17 20:50:14 +00:00
Hermes Agent 9b26a854e2 typecheck: clarify extra CHECK TYPE tokens 2026-09-17 18:46:36 +00:00
Hermes Agent 1204731785 typecheck: clarify missing CHECK TYPE IS 2026-09-17 16:42:56 +00:00
Hermes Agent 67ba1b1403 typecheck: diagnose missing class field names 2026-09-17 14:38:46 +00:00
Hermes Agent 78a83238df typecheck: diagnose missing method names 2026-09-17 12:35:57 +00:00
Hermes Agent 885c837593 typecheck: diagnose missing NEW class names 2026-09-17 10:32:03 +00:00
Hermes Agent 6dcb86b920 typecheck: diagnose missing object names 2026-09-17 08:28:23 +00:00
Hermes Agent b0dbe976de typecheck: diagnose missing class names 2026-09-17 06:25:04 +00:00
Hermes Agent 649b327f52 typecheck: diagnose missing function names 2026-09-17 04:21:38 +00:00
Hermes Agent b59945b14f typecheck: reject duplicate function names 2026-09-17 02:17:31 +00:00
Hermes Agent eda28f1699 typecheck: reject extra NEW tokens 2026-09-17 00:14:04 +00:00
Hermes Agent 15d7145ca7 typecheck: reject extra class name tokens 2026-09-16 22:09:14 +00:00
Hermes Agent 638dd8e763 typecheck: reject extra class field tokens 2026-09-16 20:05:25 +00:00
Hermes Agent d9c32ca973 typecheck: explain missing class field types 2026-09-16 17:58:42 +00:00
Hermes Agent 31d87c7a5d typecheck: reject unknown class field types 2026-09-16 15:54:26 +00:00
Hermes Agent 139838d56e typecheck: diagnose unknown NEW classes 2026-09-16 13:50:00 +00:00
Hermes Agent 7eff213a78 test: cover compatibility duplicate method names 2026-09-16 11:45:26 +00:00
Hermes Agent 50ef925367 test: cover same-named fields across classes 2026-09-16 09:41:37 +00:00
Hermes Agent bb21a1e3a4 typecheck: reject duplicate object names 2026-09-16 07:38:22 +00:00
Hermes Agent c713d2b86e typecheck: reject duplicate class declarations 2026-09-16 05:35:39 +00:00
Hermes Agent eddb3ba067 typecheck: reject duplicate class fields 2026-09-16 03:30:52 +00:00
Hermes Agent edcfd697f6 typecheck: reject duplicate object methods 2026-09-16 01:24:40 +00:00
Hermes Agent aac07309e1 test: cover duplicate method parameters 2026-09-15 23:20:00 +00:00
Hermes Agent 04e3e567e0 test: cover compatibility duplicate parameters 2026-09-15 21:16:31 +00:00
Hermes Agent dfad6387ab typecheck: diagnose duplicate parameters 2026-09-15 19:12:35 +00:00
Hermes Agent f7452c119c test: cover compatibility unknown field annotations 2026-09-15 17:06:45 +00:00
Hermes Agent 304c43ba45 typecheck: diagnose unknown method field annotations 2026-09-15 15:02:58 +00:00
Hermes Agent 88c684da37 test: cover compatibility inline field annotations 2026-09-15 12:38:49 +00:00
Hermes Agent 0a31646f5d typecheck: align inline method field annotations 2026-09-15 10:34:48 +00:00
Hermes Agent 9b5e7f3d90 typecheck: validate explicitly typed method fields 2026-09-15 08:29:29 +00:00
Hermes Agent 6282a78383 test: cover typed unknown method fields 2026-09-15 06:22:19 +00:00
Hermes Agent 83465b73f3 test: cover modern method unknown-field expressions 2026-09-15 04:17:33 +00:00
Hermes Agent 3fb0a2ec45 build: guard against compiler path truncation warnings 2026-09-15 02:12:09 +00:00
Hermes Agent 9677ed81ba test: cover modern YESNO method field assignment 2026-09-15 00:08:03 +00:00
Hermes Agent 43d596d85b test: cover compatibility method text concatenation 2026-09-14 22:01:51 +00:00
Hermes Agent 7a165f8125 test: cover method text concatenation 2026-09-14 19:59:10 +00:00
Hermes Agent 45fecc375a test: cover compatibility numeric method field assignment 2026-09-14 17:54:21 +00:00
Hermes Agent 34ed60cbe8 typecheck: diagnose compatibility method unknown fields 2026-09-14 15:50:26 +00:00
Hermes Agent d5950a981b test: cover compatibility method field returns 2026-09-14 13:47:10 +00:00
Hermes Agent 110fbf8232 test: cover compatibility method unknown field assignment 2026-09-14 11:42:50 +00:00
Hermes Agent 87badcd5d4 test: cover compatibility method unknown fields 2026-09-14 09:38:52 +00:00
Hermes Agent 7064343cee typecheck: diagnose unknown method check fields 2026-09-14 07:36:08 +00:00
Hermes Agent ae6c261156 typecheck: diagnose unknown method fields 2026-09-14 05:33:09 +00:00
Hermes Agent 5dd1616a1b test: cover modern YESNO method field checks 2026-09-14 03:27:54 +00:00
Hermes Agent 636fcc01d2 test: cover compatibility YESNO field type checks 2026-09-14 01:24:35 +00:00
Hermes Agent dfb707972e test: cover compatibility YESNO method field assignment 2026-09-13 23:21:03 +00:00
Hermes Agent 762c6506ce test: cover compatibility method field checks 2026-09-13 21:16:52 +00:00
Hermes Agent d4d32f8f07 test: cover YESNO method field diagnostics 2026-09-13 19:13:44 +00:00
Hermes Agent 2fa094c8fb validate method field diagnostics in release gate 2026-09-13 17:07:47 +00:00
Hermes Agent d690ff5a0f typecheck: name method field check diagnostics 2026-09-13 15:04:31 +00:00
Hermes Agent ae41341a7d test: cover compatibility method field diagnostics 2026-09-13 13:01:25 +00:00
Hermes Agent 915bc7f1bc typecheck: name methods in field diagnostics 2026-09-13 10:58:08 +00:00
Hermes Agent 8e9ab3c711 test: cover numeric method field assignment 2026-09-13 08:53:47 +00:00
Hermes Agent d7df4591a4 typecheck: clarify typed method field diagnostics 2026-09-13 06:50:33 +00:00
Hermes Agent a2a4d3d477 test: cover compatibility method multiplication diagnostics 2026-09-13 04:43:42 +00:00
Hermes Agent 562906c4b0 test: cover compatibility method division diagnostics 2026-09-13 02:38:54 +00:00
Hermes Agent 0ee528d9ae test: cover compatibility method subtraction diagnostics 2026-09-13 00:36:05 +00:00
Hermes Agent 747e8156e0 test: cover compatibility method addition diagnostics 2026-09-12 22:32:45 +00:00
Hermes Agent bbf1ad0b19 test: cover compatibility method addition returns 2026-09-12 20:28:46 +00:00
Hermes Agent f921e2d77d test: cover compatibility method multiplication returns 2026-09-12 18:25:09 +00:00
Hermes Agent 55e783e2c3 test: cover compatibility method subtraction returns 2026-09-12 16:21:24 +00:00
Hermes Agent 7cdc2e72b1 test: cover numeric function subtraction returns 2026-09-12 14:17:47 +00:00
Hermes Agent a886e6eccc test: cover compatibility method numeric returns 2026-09-12 12:14:13 +00:00
Hermes Agent 689d2b2bcc test: cover numeric method return division 2026-09-12 10:11:10 +00:00
Hermes Agent 1fc8e72c1d test: cover numeric method return subtraction 2026-09-12 08:08:58 +00:00
Hermes Agent ce28a6eb1c test: cover method return addition diagnostics 2026-09-12 06:05:10 +00:00
Hermes Agent a6d93a195a test: cover method return multiplication diagnostics 2026-09-12 04:01:22 +00:00
Hermes Agent 3443fb7589 test: cover method return division diagnostics 2026-09-12 01:58:25 +00:00
Hermes Agent 45a323e45b test: cover numeric function return division 2026-09-11 23:54:50 +00:00
Hermes Agent fd828112b4 test: cover division return diagnostics 2026-09-11 21:52:22 +00:00
Hermes Agent 54bee65a31 test: cover multiplication return diagnostics 2026-09-11 19:49:18 +00:00
Hermes Agent d4c9c0a26b test: cover method subtraction return diagnostics 2026-09-11 17:45:42 +00:00
Hermes Agent 2b661f65e7 test: cover subtraction return diagnostics 2026-09-11 15:42:04 +00:00
Hermes Agent b86d962af7 build: produce both release validator executables 2026-09-11 13:37:55 +00:00
Hermes Agent 856c16d25a test: cover numeric function return expressions 2026-09-11 11:35:08 +00:00
Hermes Agent dd7efc4648 typecheck: clarify arithmetic return mismatches 2026-09-11 09:31:48 +00:00
Hermes Agent 1bc33f98d8 test: cover compatibility method unknown returns 2026-09-11 07:28:39 +00:00
Hermes Agent c82d67a34a test: cover unknown method return expressions 2026-09-11 05:25:39 +00:00
Hermes Agent 34f96a6d7d typecheck: diagnose unknown return expressions 2026-09-11 03:22:05 +00:00
Hermes Agent b7d19db8a9 typecheck: validate method field return types 2026-09-11 01:16:31 +00:00
Hermes Agent e28388407d test: cover lowercase compatibility method returns 2026-09-10 23:12:18 +00:00
Hermes Agent 04a6476960 test: cover lowercase compatibility method returns 2026-09-10 21:07:18 +00:00
Hermes Agent 57db2ba3e2 test: cover lowercase compatibility return success 2026-09-10 19:03:48 +00:00
Hermes Agent 22c54fb0af test: cover lowercase compatibility return success 2026-09-10 17:00:22 +00:00
Hermes Agent 1e4f15b486 typecheck: preserve lowercase return declarations 2026-09-10 14:56:37 +00:00
Hermes Agent 561c272e81 test: cover compatibility method missing arguments 2026-09-10 12:52:43 +00:00
Hermes Agent 8876fd3f15 test: cover compatibility alias extra arguments 2026-09-10 10:49:02 +00:00
Hermes Agent 1fb43e306a ide: advertise typed-language keywords 2026-09-10 08:42:49 +00:00
Hermes Agent 6db0958d59 validate: cover complete typecheck fixture matrix 2026-09-10 06:36:34 +00:00
Hermes Agent bbdb09601b test: cover compatibility method return success 2026-09-10 04:32:04 +00:00
Hermes Agent 04be1d70e4 test: cover nested method return paths 2026-09-10 02:29:15 +00:00
Hermes Agent 9d3148ac36 test: cover incomplete method return paths 2026-09-10 00:25:12 +00:00
Hermes Agent 39be2a57ef typecheck: accept nested complete returns 2026-09-09 22:21:22 +00:00
Hermes Agent 74998a4f11 typecheck: accept complete conditional returns 2026-09-09 20:18:28 +00:00
Hermes Agent 427291f694 typecheck: diagnose conditional-only returns 2026-09-09 18:13:58 +00:00
Hermes Agent 81c4ff4177 test: cover compatibility method return types 2026-09-09 16:09:14 +00:00
Hermes Agent 762fde4379 test: cover compatibility function return types 2026-09-09 14:05:35 +00:00
Hermes Agent e26a398082 test: cover unknown method return types 2026-09-09 12:00:54 +00:00
Hermes Agent e4859e82d5 typecheck: diagnose unknown return types 2026-09-09 09:58:07 +00:00
Hermes Agent 257a4644ad typecheck: diagnose empty typed returns 2026-09-09 07:54:19 +00:00
Hermes Agent 465f3f4d26 test: cover typed method return expressions 2026-09-09 05:50:44 +00:00
Hermes Agent 57246c7a47 typecheck: infer typed parameter return expressions 2026-09-09 03:46:29 +00:00
Hermes Agent fe5269e6bc test: cover missing method returns 2026-09-09 01:43:16 +00:00
Hermes Agent 0f63ab0c71 typecheck: diagnose missing declared returns 2026-09-08 23:39:45 +00:00
Hermes Agent 9d4cffa6f6 typecheck: validate object method returns 2026-09-08 21:36:00 +00:00
Hermes Agent 8fe57974c6 typecheck: validate simple function returns 2026-09-08 19:31:29 +00:00
Hermes Agent c44db0bb16 typecheck: reject unknown expected types 2026-09-08 17:26:47 +00:00
Hermes Agent 8c3c898af7 typecheck: diagnose typed unknown object fields 2026-09-08 15:23:55 +00:00
Hermes Agent 299309ed5b test: cover text field concatenation 2026-09-08 13:20:00 +00:00
Hermes Agent e17ff862d7 test: cover reverse text concatenation 2026-09-08 11:13:20 +00:00
Hermes Agent 145e2e7109 test: cover text concatenation in object fields 2026-09-08 09:10:59 +00:00
Hermes Agent e91d4dc3f2 test: cover standalone YESNO field checks 2026-09-08 07:08:15 +00:00
Hermes Agent d413b2bf82 test: reject unlisted typecheck fixtures 2026-09-08 05:05:49 +00:00
Hermes Agent f51ce6b56a typecheck: explain text operands in addition 2026-09-08 03:02:24 +00:00
Hermes Agent 7ecaf3fc94 test: cover valid object-field subtraction 2026-09-08 00:58:01 +00:00
Hermes Agent 142d1e846e typecheck: explain text division operands 2026-09-07 20:51:05 +00:00
Hermes Agent f82901cd00 typecheck: explain text multiplication operands 2026-09-07 18:47:29 +00:00
Hermes Agent 2e3b1c725f typecheck: explain text subtraction operands 2026-09-07 16:44:18 +00:00
Hermes Agent f88b27ae8c test: cover valid object-field multiplication 2026-09-07 14:40:43 +00:00
Hermes Agent c303b7dcc3 test: cover valid object-field division 2026-09-07 12:37:57 +00:00
Hermes Agent fa6be94a3e test: require CI workflow validator in release gates 2026-09-07 10:35:22 +00:00
Hermes Agent e4d4db3541 test: cover division text operand diagnostics 2026-09-07 08:32:41 +00:00
Hermes Agent 562e53b3b4 test: cover text operands in multiplication diagnostics 2026-09-07 06:30:38 +00:00
Hermes Agent 2cf5aaf3a9 typecheck: preserve text operands in arithmetic diagnostics 2026-09-07 04:28:03 +00:00
Hermes Agent 2e990a4b00 test: cover modern chained alias method calls 2026-09-07 02:25:00 +00:00
Hermes Agent 422f17eab9 test: require complete typecheck fixture coverage 2026-09-07 00:22:07 +00:00
Hermes Agent 4a232501e7 test: harden CI workflow gate detection 2026-09-06 22:18:31 +00:00
Hermes Agent a9abf80fbc test: cover chained TEXT field checks 2026-09-06 20:14:33 +00:00
Hermes Agent d3fcce0221 test: cover compatibility aliased method calls 2026-09-06 18:11:32 +00:00
Hermes Agent 75b2152f23 test: cover chained object field assignments 2026-09-06 16:09:10 +00:00
Hermes Agent 9b93bea7e0 test: cover chained object field aliases 2026-09-06 14:06:26 +00:00
Hermes Agent 1f5b5387b0 test: cover chained object method aliases 2026-09-06 12:03:18 +00:00
Hermes Agent e111f46a1d typecheck: validate aliased object field checks 2026-09-06 09:59:52 +00:00
Hermes Agent a2dafadbf8 typecheck: validate explicitly typed object fields 2026-09-06 07:56:38 +00:00
Hermes Agent 6198b75f66 typecheck: validate aliased object fields 2026-09-06 05:53:57 +00:00
Hermes Agent cb061886e3 typecheck: accept nested map values in lists 2026-09-06 03:49:45 +00:00
Hermes Agent 3d372988f4 test: cover numeric expressions in text fields 2026-09-06 01:47:00 +00:00
Hermes Agent 0fd4ca19e9 package: validate lock release versions 2026-09-05 23:43:06 +00:00
Hermes Agent ef534aaa2b test: validate compound object field expressions 2026-09-05 21:38:58 +00:00
Hermes Agent 5b29e9abee typecheck: infer simple expression results 2026-09-05 19:35:41 +00:00
Hermes Agent e35341cf99 package: explain invalid manifest format versions 2026-09-05 11:26:32 +00:00
Hermes Agent d169fedc3a package: validate lockfile format versions 2026-09-05 07:21:55 +00:00
Hermes Agent 023badf016 package: reject duplicate lockfile checksums 2026-09-05 05:18:41 +00:00
Hermes Agent 6739a82f5e package: reject duplicate manifest sources 2026-09-05 01:14:24 +00:00
Hermes Agent 8f449898bd test: cover object field expressions 2026-09-04 23:11:44 +00:00
Hermes Agent 5136437e44 package: reject duplicate project manifest versions 2026-09-04 21:07:52 +00:00
Hermes Agent 20a181b631 package: reject duplicate manifest versions 2026-09-04 19:04:20 +00:00
Hermes Agent e66dded2e4 package: require a project manifest name 2026-09-04 17:01:20 +00:00
Hermes Agent ae6b52811e package: reject duplicate manifest checksums 2026-09-04 14:57:29 +00:00
Hermes Agent beac4c634b package: reject duplicate manifest names 2026-09-04 12:54:53 +00:00
Hermes Agent c585356ce3 package: reject duplicate lock entries 2026-09-04 10:51:49 +00:00
Hermes Agent 9dac745e8d package: reject duplicate project entries 2026-09-04 08:47:59 +00:00
Hermes Agent 685f56579f fix: validate local package sources 2026-09-04 06:45:15 +00:00
Hermes Agent eec5dba646 fix: validate package manifest versions 2026-09-04 04:42:01 +00:00
Hermes Agent dcc3e947ad fix: validate project manifest versions 2026-09-04 02:38:28 +00:00
Hermes Agent 7a60af32bf fix: require exact package manifest versions 2026-09-04 00:34:32 +00:00
Hermes Agent 0556a3610b fix: require exact package manifest checksums 2026-09-03 22:31:40 +00:00
Hermes Agent a9237346fa fix: require exact package manifest names 2026-09-03 20:28:18 +00:00
Hermes Agent 532010b5dd ci: gate package security validation 2026-09-03 18:26:10 +00:00
Hermes Agent d29390d143 package: validate manifest names 2026-09-03 16:23:21 +00:00
Hermes Agent 7450c306be package: reject orphan lock entries 2026-09-03 12:42:34 +00:00
Hermes Agent fd28ee7ec1 package: verify lock checksums in doctor 2026-09-03 10:38:24 +00:00
Hermes Agent 011a60f140 package: block list with unsafe entries 2026-09-03 08:34:02 +00:00
Hermes Agent 98b8d311c3 package: block init with unsafe entries 2026-09-03 06:30:01 +00:00
Hermes Agent f8089f0758 package: allow removing unsafe entries 2026-09-03 04:26:29 +00:00
Hermes Agent 4258a341ce package: block add when manifest has unsafe names 2026-09-03 02:23:31 +00:00
Hermes Agent 21716568a5 package: reject unsafe project names 2026-09-03 00:19:56 +00:00
Hermes Agent 475b54eb6a package: align new project manifests 2026-09-02 22:16:30 +00:00
Hermes Agent 861d0af401 package: cap local package names 2026-09-02 20:13:58 +00:00
Hermes Agent f2acef6a12 typecheck: validate CALL unknown methods 2026-09-02 18:10:02 +00:00
Hermes Agent bbb5787e80 typecheck: diagnose empty CALL arguments 2026-09-02 16:06:18 +00:00
Hermes Agent 873177f216 typecheck: validate missing unchecked method args 2026-09-02 14:02:41 +00:00
Hermes Agent 1e3e7fd9fa typecheck: diagnose missing unchecked function args 2026-09-02 12:00:07 +00:00
Hermes Agent 3173eafb36 typecheck: preserve fields after methods 2026-09-02 09:56:18 +00:00
Hermes Agent b8385f675a typecheck: preserve later method arity checks 2026-09-02 07:53:04 +00:00
Hermes Agent 0839bdeb5d typecheck: handle later class methods 2026-09-02 05:49:51 +00:00
Hermes Agent 614fffbb62 typecheck: diagnose unknown CALL functions 2026-09-02 03:46:53 +00:00
Hermes Agent b7b923faf5 typecheck: diagnose unknown DO functions 2026-09-02 01:43:55 +00:00
Hermes Agent eed3136439 typecheck: diagnose extra method args 2026-09-01 23:39:41 +00:00
Hermes Agent d5945bed35 typecheck: diagnose extra function args 2026-09-01 21:36:40 +00:00
Hermes Agent 8237792cc3 typecheck: validate CALL object method args 2026-09-01 19:32:22 +00:00
Hermes Agent 6edbd587bc package: fail remove on unsafe lock refresh 2026-09-01 17:29:18 +00:00
Hermes Agent b75b05d0fa docs: refresh gitea handoff status 2026-09-01 15:25:25 +00:00
Hermes Agent 246a5a28b2 typecheck: validate missing method args 2026-09-01 15:24:24 +00:00
Hermes Agent 48189afd80 typecheck: diagnose missing checked function args 2026-09-01 13:21:54 +00:00
Hermes Agent a9612c5074 typecheck: diagnose CALL method before NEW typos 2026-09-01 11:18:58 +00:00
Hermes Agent 73f5395b28 docs: update gitea handoff status 2026-09-01 09:15:23 +00:00
Hermes Agent 33639de4cc package: reject unsafe names during lock 2026-09-01 09:14:38 +00:00
Hermes Agent 93e16f7241 package: reject unsafe names in doctor 2026-09-01 07:11:45 +00:00
Hermes Agent 8153aed9cb typecheck: diagnose CALL method before NEW 2026-09-01 05:07:58 +00:00
Hermes Agent a5c78cbfe1 ci: gate current release validation 2026-09-01 03:02:01 +00:00
Hermes Agent e615d6c764 docs: refresh Codeberg auth handoff 2026-08-30 03:02:19 +00:00
Hermes Agent 49ec9345a7 docs: refresh Codeberg auth handoff 2026-08-29 03:02:12 +00:00
Hermes Agent 18a4a8d30d docs: refresh Codeberg auth handoff 2026-08-28 03:01:57 +00:00
Hermes Agent d357caecbe docs: refresh Codeberg auth handoff 2026-08-27 03:02:22 +00:00
Hermes Agent 356bf0e54d docs: refresh Codeberg auth handoff 2026-08-26 03:01:51 +00:00
Hermes Agent 6b2dca4423 docs: refresh Codeberg auth handoff 2026-08-25 03:01:27 +00:00
Hermes Agent f6da23d32e docs: refresh Codeberg auth handoff 2026-08-24 03:02:12 +00:00
Hermes Agent 2bc4ce7e48 docs: refresh Codeberg auth blocker handoff 2026-08-23 03:02:04 +00:00
Hermes Agent 92407dabbe docs: record Codeberg auth blocker 2026-08-22 03:03:44 +00:00
Hermes Agent 9fdc564736 docs: refresh Codeberg auth handoff 2026-08-22 03:02:13 +00:00
Hermes Agent 351a52e261 docs: refresh Codeberg push handoff 2026-08-21 03:01:57 +00:00
Hermes Agent 5d53b16a77 docs: add Claro review handoffs 2026-08-17 03:10:44 +00:00
Hermes Agent 1cbdc1e56a feat: diagnose unknown object methods 2026-08-13 15:30:33 +00:00
216 changed files with 4634 additions and 50 deletions
+12
View File
@@ -15,6 +15,18 @@ jobs:
run: make run: make
- name: Run tests - name: Run tests
run: ./claro test run: ./claro test
- name: Run current release validation
run: ./claro validate
- name: Validate typecheck diagnostics
run: python3 tools/validate_typecheck_diagnostics.py
- name: Validate version convention
run: python3 tools/validate_version_convention.py
- name: Validate package security
run: python3 tools/validate_package_security.py
- name: Validate compiler warnings
run: python3 tools/validate_compiler_warnings.py
- name: Validate CI workflow coverage
run: python3 tools/validate_ci_workflow.py
- name: Check lessons - name: Check lessons
run: | run: |
./claro check lessons/01_hello.claro ./claro check lessons/01_hello.claro
+249
View File
@@ -1,5 +1,254 @@
# Changelog # Changelog
### Diagnose missing class field names
- `claro typecheck` now explains how to repair a bare `HAS` declaration instead of reporting a confusing missing type for an unnamed field.
- Added focused coverage to the complete typecheck diagnostic validation matrix.
### Diagnose missing method names
- `claro typecheck` now explains how to repair a bare `TEACH` declaration inside a class instead of describing it as a top-level function.
- Added focused coverage to the complete typecheck diagnostic validation matrix.
### Diagnose missing class names
- `claro typecheck` now explains how to repair a bare `CLASS` declaration instead of silently accepting a class with no name.
- Added focused coverage to the complete typecheck diagnostic validation matrix.
### Diagnose missing function names
- `claro typecheck` now explains how to repair a bare `TEACH` declaration instead of silently accepting a function with no name.
- Added focused coverage to the complete typecheck diagnostic validation matrix.
### Diagnose unknown class field types
- `claro typecheck` now rejects class fields such as `HAS score BANANA` with a beginner-facing diagnostic that names the class and field, lists supported type examples, and suggests using a Claro type.
### Validate compatibility duplicate-parameter diagnostics
- Added focused coverage proving that compatibility `TAKES` / `LEARNED` functions reject repeated parameter names with the same repair-oriented diagnostic as modern functions.
- Added the fixture to the complete typecheck diagnostic validation matrix.
### Validate compatibility unknown inline method-field annotations
- Added focused coverage proving that compatibility `TAKES` / `LEARNED` methods reject unknown inline field annotations with the same repair-oriented diagnostic as modern methods.
### Diagnose unknown inline method-field annotations
- `claro typecheck` now rejects unknown inline field annotations such as `BANANA` and suggests the class-declared `HAS` type.
- Added focused negative coverage to the complete typecheck validation matrix.
### Align inline method-field annotations with class fields
- `claro typecheck` now compares an inline method assignment annotation with the class field declared by `HAS`.
- A mismatch such as `SET score TEXT 10` inside a method for `HAS score NUMBER` explains both types and suggests the class-declared type.
- Added positive and negative fixtures to the complete typecheck validation matrix.
### Validate compatibility inline method-field annotations
- Added matching positive and negative coverage for `TEACH ... TAKES ...` / `LEARNED` methods.
- Release validation now protects the same class-declared-type diagnostic for older compatibility lessons.
- Added focused modern-method coverage for the learner-facing diagnostic produced when an undeclared field is assigned from an expression whose type is not inferable yet.
## Unreleased
- Method-body `CHECK TYPE` diagnostics now name the current class method when a declared field is checked against the wrong type, with focused positive and negative validation coverage.
- Typecheck diagnostics for typed method-body field assignments now name the class method and arithmetic operation when a known TEXT operand is used in a NUMBER field update.
### Compatibility method field-assignment diagnostics
- Added focused positive and negative typecheck fixtures for older `TEACH ... TAKES ...` / `LEARNED` methods that assign to typed class fields.
- Release validation now preserves the learner-facing `Class.method` name in these compatibility diagnostics.
### Validate compatibility method multiplication diagnostics
- Added focused negative typecheck coverage proving that the older `TAKES` / `LEARNED` method syntax identifies a TEXT operand in a NUMBER multiplication return and explains the required operand type.
- Wired the fixture into the standalone typecheck validator and `claro validate`.
### Validate compatibility method division diagnostics
- Added focused negative typecheck coverage proving that the older `TAKES` / `LEARNED` method syntax identifies a TEXT operand in a NUMBER division return and explains the required operand type.
- Wired the fixture into the standalone typecheck validator and `claro validate`.
### Validate compatibility method subtraction diagnostics
- Added focused negative typecheck coverage proving that the older `TAKES` / `LEARNED` method syntax identifies a TEXT operand in a NUMBER subtraction return and explains the required operand type.
- Wired the fixture into the standalone typecheck validator and `claro validate`.
### Validate compatibility method addition diagnostics
- Added focused negative typecheck coverage proving that the older `TAKES` / `LEARNED` method syntax identifies a TEXT operand in a NUMBER addition return and explains the required operand type.
- Wired the fixture into the standalone typecheck validator and `claro validate`.
### Validate compatibility method addition returns
- Added focused positive typecheck coverage proving that the older `TEACH ... TAKES ... RETURNS NUMBER` / `LEARNED` method syntax accepts a numeric addition return after `CHECK TYPE` establishes the parameter type.
- Wired the fixture into the standalone typecheck validator and `claro validate`.
### Validate compatibility method multiplication returns
- Added focused release validation for compatibility (`TAKES` / `LEARNED`) methods returning numeric multiplication results.
### Validate compatibility method subtraction returns
- Added focused positive typecheck coverage proving that the older `TEACH ... TAKES ... RETURNS NUMBER` / `LEARNED` method syntax accepts a numeric subtraction return after `CHECK TYPE` establishes the parameter type.
- Wired the fixture into the standalone typecheck validator and `claro validate`.
### Validate numeric function subtraction returns
- Added focused positive typecheck coverage proving that a typed function can return a numeric subtraction expression after `CHECK TYPE` establishes its parameter type.
- Wired the fixture into the standalone typecheck validator and `claro validate`.
### Validate division return diagnostics
- Added focused `claro typecheck` coverage proving that a typed function returning `amount / "oops"` identifies division, the required `NUMBER` operands, and the offending `TEXT` value.
- Wired the negative fixture into the complete typecheck validator and `claro validate` coverage.
### Validate numeric function return expressions
- Added a focused positive typecheck fixture proving that a typed function can return a numeric multiplication expression after `CHECK TYPE` establishes its parameter type.
- Wired the fixture into the standalone typecheck validator and `claro validate`.
### Advertise typed-language keywords to IDE helpers
- Added `RETURNS`, `CHECK`, and `TYPE` to `claro ide` keyword metadata so editor integrations can recognize the current typed function and type-checking syntax.
- Extended the IDE metadata validator and documented the updated completion surface.
### Validate the complete typecheck matrix
- `claro validate` now runs the complete focused typecheck fixture matrix, including method-call, alias, return, and expression fixtures that were previously covered only by the standalone diagnostic validator.
### Validate compatibility method return types
- Added focused coverage proving that the older `TEACH ... TAKES ... RETURNS TYPE` / `LEARNED` method syntax receives the same learner-facing return-type diagnostic as modern methods.
- Added the compatibility method fixture to the complete typecheck diagnostics validator.
### Validate incomplete method return paths
- Added focused typecheck coverage proving that a typed method with an incomplete conditional return reports the same learner-facing missing-path diagnostic as a typed function.
- Added the method fixture to both `claro validate` and the complete typecheck diagnostics validator.
### Validate compatibility function return types
- Added focused coverage proving that the older `TEACH ... TAKES ... RETURNS TYPE` / `LEARNED` syntax receives the same learner-facing return-type diagnostic as modern functions.
- Added the compatibility fixture to both `claro validate` and the complete typecheck diagnostics validator.
### Validate unknown method return types
- Added focused `claro typecheck` regression coverage for an object method declaring an unsupported `RETURNS` type such as `BANANA`.
- The release validator now checks function and method unknown-return-type diagnostics separately.
### Diagnose unknown declared return types
- `claro typecheck` now reports a learner-facing error when a function or object method declares an unsupported `RETURNS` type such as `BANANA`.
- Added focused negative-fixture coverage and release-validator coverage for the invalid declaration.
### Diagnose empty typed returns
- `claro typecheck` now reports a beginner-facing error when a function or method declares `RETURNS TYPE` but uses `RETURN` without a value.
- Added a focused negative fixture and release-validation coverage for the missing return expression.
### Check typed parameter expressions in returns
- `claro typecheck` now carries a function or method parameter's `CHECK TYPE` metadata into later return-expression inference.
- Added positive and negative arithmetic return fixtures for functions and object methods so a declared return type cannot silently accept an expression whose parameter type is already known.
### Check simple function return types
- Added `TEACH name ... RETURNS TYPE` syntax for a focused static return check.
- `claro typecheck` now reports the expected and inferred types when a `RETURN` expression does not match.
- Added positive and negative fixtures and wired both into `claro validate` and the complete typecheck diagnostics validator.
### Diagnose explicitly typed unknown object fields
- Added focused typecheck coverage for `SET player.level NUMBER 3` when `Player` declares no `level` field.
- `claro typecheck` now gives the same beginner-facing missing-`HAS` hint for explicitly typed unknown fields as it does for untyped field assignments.
### Reject unlisted typecheck fixtures
- `tools/validate_typecheck_diagnostics.py` now discovers `tests/typecheck_*.claro` files and fails when a fixture is missing from the validator's positive or negative lists.
- This keeps new learner-facing typecheck examples from silently escaping release validation.
### Explain text operands in object-field addition
- Added focused typecheck coverage for `SET player.score player.name + 1`.
- `claro typecheck` now names the `TEXT` operand and explains that addition into a `NUMBER` field needs numeric values, matching the existing subtraction, multiplication, and division diagnostics.
### Complete numeric object-field arithmetic coverage
- Added a focused positive typecheck fixture for numeric subtraction in an object field.
- Added the fixture to both the complete typecheck diagnostics validator and `claro validate`, keeping valid subtraction beside the existing division/multiplication positives and text-operand diagnostics.
### Complete typecheck fixture validation
- Added regression coverage requiring the focused typecheck validator to list every `typecheck_*.claro` fixture, plus the existing object-field validation script.
- Added the two previously omitted positive fixtures so `tools/validate_typecheck_diagnostics.py` now exercises the complete typecheck fixture set.
### CI release-gate validator hardening
- Added focused regression coverage for the workflow validator.
- `tools/validate_ci_workflow.py` now checks release commands inside actual `run` steps, so commented-out commands cannot make CI coverage appear complete.
- The validator now requires its own executable CI command, protecting the workflow coverage check from being removed silently.
### Object-alias field CHECK TYPE diagnostics
- Added focused typecheck coverage for `CHECK TYPE alias.field IS TYPE` after a simple object alias.
- `claro typecheck` now compares an aliased object's declared field type with the requested `CHECK TYPE` type.
### Nested container type validation
- Added a focused nested-container typecheck example for adding a typed map to a typed list.
- Updated container matching so `LIST OF MAP` accepts map values with their own type metadata while preserving existing list/map mismatch diagnostics.
### Object-field expression validation
- Added positive and negative typecheck fixtures for assigning object fields from another field and from an arithmetic field expression.
- Added both fixtures to `claro validate` and the focused typecheck diagnostics validator.
- Added a focused negative fixture for the reverse expression mismatch: storing a numeric expression in a `TEXT` object field now remains covered by the release validation matrix.
- `claro package doctor` now rejects duplicate `manifest-version:` fields in `claro.project` instead of accepting the first value and overlooking ambiguous project metadata.
- `claro package doctor` now rejects duplicate package entries in `claro.lock` instead of allowing ambiguous lockfile data.
- `claro package doctor` now rejects duplicate `name:` entries in a package manifest instead of accepting ambiguous package identity data.
- `claro package doctor` now rejects duplicate `checksum:` entries in a package manifest instead of accepting ambiguous integrity data.
- `claro package doctor` now rejects listed package manifests whose `version:` only starts with the supported local package version, such as `version: 10`.
- `claro package doctor` now rejects listed package manifests whose `source:` only starts with the supported local source, such as `source: local-extra`.
- `claro package doctor` now rejects project files whose `manifest-version:` only starts with the supported value, such as `manifest-version: 10`.
## v1.18.26-dev exact package manifest-version validation
- Added package-security coverage for a manifest version that only starts with the supported version, such as `manifest-version: 10` for the current `manifest-version: 1` format.
- Changed `claro package doctor` to compare the complete `manifest-version:` value instead of accepting a version as a substring.
## v1.18.26-dev exact package checksum validation
- Added package-security coverage for a manifest checksum with valid digest text followed by extra data.
- Changed `claro package doctor` to compare the complete `checksum:` field instead of accepting a checksum as a substring.
## v1.18.26-dev exact package manifest-name validation
- Added package-security coverage for a manifest name that only starts with the expected package name, such as `name: math-tools-extra` for package `math-tools`.
- Changed `claro package doctor` to compare the complete `name:` value, preventing prefix matches from being accepted as valid manifests.
## v1.18.26-dev package list unsafe-name diagnostic
- Added focused package-security validation for `claro package list` when `claro.project` already contains an unsafe package name such as `../bad`.
- Changed `claro package list` to fail with the existing beginner-facing `BAD package name: ...` diagnostic instead of displaying unsafe entries as normal package names.
## v1.18.26-dev missing unchecked function argument diagnostic
- Added a focused negative `claro typecheck` fixture for calling a simple function without its declared argument, such as `TEACH greet name` followed by `DO greet`.
- Improved the static arity check so simple functions without `CHECK TYPE` hints still report a beginner-facing missing-argument diagnostic.
- Wired the fixture into the typecheck diagnostics validator and `claro validate`.
## v1.18.26-dev CI release validation coverage
- Added `tools/validate_ci_workflow.py` to assert that Forgejo/Gitea CI keeps running Claro's current release gates.
- Updated `.forgejo/workflows/ci.yml` to run `claro validate`, typecheck diagnostics validation, version convention validation, and the CI workflow coverage check in addition to the existing smoke tests.
- Documented the CI coverage validator in the testing docs and current status/roadmap notes.
## v1.18.26-dev unknown object-field expression diagnostic ## v1.18.26-dev unknown object-field expression diagnostic
- Added a focused negative `claro typecheck` fixture for assigning an expression with no inferable static type to an undeclared object field, such as `SET player.level score + 1` after `NEW Player player`. - Added a focused negative `claro typecheck` fixture for assigning an expression with no inferable static type to an undeclared object field, such as `SET player.level score + 1` after `NEW Player player`.
+10
View File
@@ -0,0 +1,10 @@
# Gitea Push Handoff
No prepared local commit is waiting on authentication for the configured private Gitea remote.
- Updated: `2026-09-01T15:24:30Z`
- Configured publication remote: `gitea` (`ssh://git@gitea.142-44-162-98.sslip.io:2222/RayPals/Claro.git`)
- Latest completed work: `typecheck: validate missing method args`
- Verification rule: compare `git rev-parse HEAD` with `GIT_TERMINAL_PROMPT=0 git ls-remote gitea refs/heads/main` after each push.
The older Codeberg authentication blocker is historical only. This scheduled job is now configured to publish only to the private Gitea remote. Verify each completed run by comparing local `HEAD` with Gitea `main`.
+281
View File
@@ -0,0 +1,281 @@
# Handoff to GPT-5.6-Luna — Claro Project Review
Prepared: 2026-08-17 (by Claude, evidence-based; see "Commands actually run" for what was verified in this session).
This document distinguishes **VERIFIED** (I ran it in this session, in this checkout, and observed the result) from **CLAIMED** (asserted in existing docs/commit messages/handoff notes, not independently re-verified beyond what's noted).
---
## 1. Project purpose and architecture
**Purpose** (from `README.md`, VERIFIED by reading): Claro is a small, readable scripting language/interpreter aimed at beginners, particularly learners with learning disabilities. It favors plain-text keywords (`SET`, `SAY`, `ASK`, `IF`/`END`, `TEACH`/`DO`) over punctuation-heavy syntax, while layering in optional static typing, objects/classes, a local package/project workflow, and offline-friendly HTTP networking.
**Architecture** (VERIFIED by reading `src/claro.c` and `Makefile`):
- Single-file C99 interpreter: `src/claro.c`, 641 lines (but extremely dense — most "lines" are long semicolon-chained C statements with many statements per physical line, not idiomatic multi-line C). `wc -l` undercounts real logical complexity substantially.
- Built with plain `gcc -std=c99 -O0 -o claro src/claro.c -lm` (see `Makefile`). No external dependencies beyond libm and, optionally, `curl` as a subprocess for real HTTP(S).
- Two build outputs are committed directly to the repo root: `claro` and `claro.exe` (both tracked in git despite `.gitignore` listing them — see §4 risk).
- CLI subcommands dispatch from `main()`: `test`, `validate`, `check`, `typecheck`, `fmt`, `doctor`, `examples`, `repl`, `new`, `run`, `package *`, `ide`, `--version`, `help`.
- The static type checker lives almost entirely in one function, `typecheck_file()` at `src/claro.c:550` — a single very long line implementing per-statement dispatch for `SET`, `DO`/`CALL`, and `CHECK TYPE`, including inline object/class field and method resolution. `run_validate()` (`src/claro.c:639`) is the master validation entrypoint invoked by `claro validate`, hardcoding the full list of "good" (must type-check clean) and "bad" (must produce a diagnostic) fixture files.
- Object/class support: `NEW Class name` registers a synthetic type `OBJECT:Class` in the type environment (`src/claro.c:555`) and pre-seeds `name.field` types from `HAS` declarations collected by `collect_class_field_type_checks()`. Field/method diagnostics (unknown field, unknown method, use-before-`NEW`) are all resolved through this same type-environment lookup at typecheck time — this is a static, line-by-line heuristic checker, not a full parser/AST-based type system.
- Tests: `tests/` holds 93 `.claro` fixture files, of which 33 are `typecheck_*` fixtures (paired `_good`/`_bad` cases) driving both `claro validate` and `tools/validate_typecheck_diagnostics.py`. Non-typecheck tests use `.claro`/`.out` pairs run via `claro test`.
- `tools/*.py` are auxiliary Python 3 validation scripts (no pip dependencies observed) for specific feature slices (typecheck diagnostics, concurrency, IDE metadata, LSP helper, package security, version convention, per-RC/version validation).
**Recent development focus** (VERIFIED via `git log --stat` on the last 6 commits): the last five feature commits (`68104bd` → `1cbdc1e`) are a tightly incremental sequence building out **static diagnostics for simple object fields and methods** — missing-`NEW` detection, unknown-field/unknown-method detection, and wrong-type detection — each commit touching `src/claro.c`, one new `tests/typecheck_*_bad.claro` fixture, `tools/validate_typecheck_diagnostics.py`, and three docs files (`README.md`, `docs/ADVANCED_STATIC_TYPING.md`, `docs/CURRENT_STATUS.md`, `docs/ROADMAP.md`) in lockstep. This is a consistent, disciplined pattern: every behavior change ships with a fixture and a doc update in the same commit.
---
## 2. Current branch/status (VERIFIED)
- Branch: `main`. Working tree is clean except for one untracked file: `CODEBERG_PUSH_HANDOFF.md` (present before this session, left untouched — see §7).
- No modifications, commits, or pushes were made in this session.
- Three remotes configured: `origin` = Codeberg (`https://codeberg.org/RayPals/Claro.git`), `gitea` = self-hosted Gitea over SSH, `github` = `https://github.com/RayPals/Claro.git`.
- After `git fetch` on all three remotes (read-only; no push attempted):
- `origin/main` (Codeberg) = `40f7881` ("feat: diagnose method calls before object creation") — **1 commit behind local `HEAD` (`1cbdc1e`)**. This exactly matches the blocker described in `CODEBERG_PUSH_HANDOFF.md` (§7).
- `gitea/main` = `1cbdc1e` — **identical to local `HEAD`**, i.e. the Gitea mirror is fully up to date and already has the commit that failed to reach Codeberg.
- `github/main` = `68104bd` — **4 commits behind local `HEAD`**, missing all five of the most recent object-field/method diagnostic commits.
- So: local `HEAD` is the most advanced ref anywhere. Gitea already has it. Codeberg and GitHub do not.
---
## 3. Files / recent changes of interest
- `src/claro.c:550` — `typecheck_file()`, the whole static-typechecker implementation.
- `src/claro.c:639` — `run_validate()`, the hardcoded list of fixtures `claro validate` must pass/fail correctly against.
- `tests/typecheck_method_unknown_method_bad.claro`, `tests/typecheck_method_unknown_object_bad.claro`, `tests/typecheck_object_field_unknown_expression_bad.claro`, `tests/typecheck_object_field_unknown_object_bad.claro` — the four newest negative fixtures (last four feature commits).
- `tools/validate_typecheck_diagnostics.py` — asserts exact diagnostic text for every `_bad` fixture and "Type check OK" for every `_good` fixture; this is the source of truth for exact error-message wording.
- `docs/ADVANCED_STATIC_TYPING.md` and `docs/CURRENT_STATUS.md` — kept in sync with each feature commit; read these together with `docs/ROADMAP.md` §"Near-term cleanup priorities" for the project's own stated next steps.
- `CODEBERG_PUSH_HANDOFF.md` (untracked, root) — a prior handoff note describing a failed Codeberg push (see §7). Left unmodified per instructions.
- `claro` / `claro.exe` (repo root) — prebuilt binaries, tracked in git even though `.gitignore` lists both names (git tracks files added before the ignore rule existed, or `git add -f` was used at some point — not verified which).
---
## 4. Commands actually run this session, and real results (all VERIFIED)
All builds were done to `/tmp` to avoid touching the tracked binaries; no source files were modified.
```
$ gcc -std=c99 -O0 src/claro.c -o /tmp/claro_build -lm
```
→ Exit 0. Three `-Wformat-truncation` warnings in `create_package_folder()` (snprintf buffer-size warnings on `path[512]`/`readme[512]`), no errors.
```
$ cmp /tmp/claro_build ./claro
```
→ **Identical.** The tracked `./claro` binary is byte-for-byte reproducible from `src/claro.c` at current `HEAD` with this exact compiler/flags — the repo is not carrying a stale or hand-edited binary.
```
$ ./claro --version
```
→ `Claro v1.18.26` — matches `README.md` and `CHANGELOG.md`.
```
$ ./claro test
```
→ `PASS: 0 failure(s)` (all fixture `.claro`/`.out` pairs matched).
```
$ ./claro validate
```
→ Ran doctor + all `claro test` fixtures + lesson/example `claro check` + full `typecheck_*` good/bad matrix. Ends with `Validation passed. Claro v1.18.26 foundation checks are ready for use.`
```
$ python3 tools/validate_typecheck_diagnostics.py
```
→ Exit 0, `Typecheck diagnostics validation complete`. Every asserted diagnostic string matched exactly, including the two newest fixtures (`typecheck_method_unknown_method_bad.claro`, `typecheck_method_unknown_object_bad.claro`).
```
$ ./claro doctor
```
→ All checks `OK`, `Claro folder looks ready.`
```
$ ./claro check examples/quiz.claro
$ make check
```
→ All `OK` (quiz.claro, lessons/01_hello.claro, lessons/03_variables.claro, lessons/08_functions.claro).
```
$ ./claro typecheck tests/typecheck_method_unknown_method_bad.claro
```
→ `tests/typecheck_method_unknown_method_bad.claro:11: Object Player has no method fly. Check the method name or add TEACH fly inside CLASS Player.` (exit 1, as intended for a negative fixture).
```
$ git fetch origin main && git fetch gitea main && git fetch github main
```
→ All three succeeded (network reachable, read-only). Results in §2.
```
$ git status (before and after all of the above)
```
→ Unchanged: only the pre-existing untracked `CODEBERG_PUSH_HANDOFF.md`. No stray files were left behind by test/validate runs (e.g. no leftover `packages/`, no `MyProject/`, no `network_demo.json`).
**Not run:** `claro new`, `claro package *`, `claro repl`, `claro ide`, `HTTP GET`/`HTTP SAVE` against real `http://`/`https://` URLs, `run_tests.bat`/`build.bat`/`build.ps1` (Windows-only), and any `tools/validate_*` script not shown above (e.g. `validate_concurrency.py`, `validate_ide_metadata.py`, `validate_lsp_helper.py`, `validate_package_security.py`, per-RC scripts) — these were not exercised and their status should be treated as unknown, not passing.
---
## 5. Current defects / blockers
1. **Codeberg push blocker (CLAIMED in `CODEBERG_PUSH_HANDOFF.md`, corroborated by this session's `git fetch`)**: local `HEAD` (`1cbdc1e`) cannot reach `origin/main` (Codeberg) via HTTPS; the prior attempt failed with "Credentials are incorrect or have expired" using an askpash script against `CODEBERG_TOKEN`. This session's read-only `git fetch origin main` succeeded (network path to Codeberg is fine), so the issue is specifically push authentication/credential validity, not connectivity. This was **not re-attempted** in this session per instructions (no push).
2. **GitHub mirror is stale by 4 commits** (VERIFIED via `git fetch github main`). Not previously flagged in any existing handoff doc — this is new information from this session.
3. **Committed build artifacts** (`claro`, `claro.exe`) are tracked in git despite being listed in `.gitignore`. They are currently byte-identical to a fresh build from `HEAD` (verified above), so they aren't stale today, but nothing prevents future drift since nothing in CI enforces binary-vs-source parity — a future push could easily commit source changes without rebuilding, leaving a stale binary silently in the repo.
4. **Compiler warnings** (VERIFIED): `-Wformat-truncation` on `create_package_folder()` in `src/claro.c` (buffer-size warnings around `path`/`readme`/`meta` snprintf calls at ~`src/claro.c:587`). Not fatal, not currently causing test failures, but worth resolving since `package init`/`package add` write these files for real projects — a sufficiently long package name plus deep path could theoretically truncate a written manifest path.
5. **`typecheck_file()` is a single ~90-statement function on one physical line** (`src/claro.c:550`) mixing lexing, type-environment maintenance, and all diagnostic logic for `SET`/`DO`/`CALL`/`CHECK TYPE`. This is a maintainability risk more than a correctness defect today (all fixtures pass), but each new diagnostic (5 of the last 5 feature commits) adds more branches to this one function/line, compounding review difficulty.
6. **CI workflow (`.forgejo/workflows/ci.yml`, VERIFIED by reading) does not run `claro validate` or `tools/validate_typecheck_diagnostics.py`** — it only runs `make`, `./claro test`, three lesson `claro check` calls, and `tools/validate_rc3.py`. So the entire typecheck-diagnostics matrix (33 fixtures) that this session hand-verified passes is **not covered by the repo's own CI**, only by manual/local runs. If Codeberg Actions (or Forgejo Actions) mirrors this workflow, a regression in `typecheck_file()` could land without CI catching it.
---
## 6. Risks
- **Single dense source file with no automated static analysis in CI** (no `-Wall`/`-Wextra` gate visible in `Makefile` or CI; warnings above were only surfaced because I passed `-std=c99 -O0` — the same as `Makefile` — and gcc emitted them anyway to stderr, not because CI checks for them).
- **Push-credential blocker means "local main" and "Codeberg main" have diverged for at least 6 days** (commit `1cbdc1e` dated in the repo's commit history vs. the handoff note's `2026-08-16` timestamp) with no CI proof that the unpushed commit is what actually will land — anyone treating Codeberg as the source of truth is looking at stale state.
- **Three-remote setup (Codeberg/Gitea/GitHub) with no documented sync policy** found in the repo — `gitea` happens to be current, `github` is stale by design or neglect, unclear which is intended as canonical beyond `origin` = Codeberg per `CODEBERG_PUSH_HANDOFF.md`'s framing.
- **No test coverage found for the compiler warnings' code path** (`create_package_folder`) — `claro package add` isn't exercised by `claro test`/`claro validate`, only by `tools/validate_v1_16.py` and `tools/validate_package_security.py`, neither of which was run this session.
---
## 7. Existing handoff note — preserved unchanged
`CODEBERG_PUSH_HANDOFF.md` (untracked, repo root) was read but **not modified**, per instructions. Summary of its claims (CLAIMED, not re-verified beyond the `git fetch` cross-check in §2, which is consistent with it):
- Local commit `1cbdc1e` could not be pushed to `origin/main` (Codeberg) due to an HTTPS credential failure with `CODEBERG_TOKEN` via non-interactive askpass.
- It lists the same validation commands (`gcc` build, `claro typecheck` on the unknown-method fixture, `validate_typecheck_diagnostics.py`, `claro test`, `claro validate`) as having passed prior to the push attempt — this session independently re-ran all of these and got the same pass results (§4), so that portion of the note is corroborated, not just claimed.
- Instructs: "After writing or updating this handoff note, rerun validation before making more source changes or retrying the push." This session did not retry the push (out of scope) and made no source changes.
---
## 8. Recommended next development task
Given the state above, in priority order:
1. **Resolve the Codeberg push credential issue** (human/credential-owner action — outside what an agent should do without explicit authorization: needs a valid `CODEBERG_TOKEN` or interactive re-auth). Until resolved, Codeberg `main` will keep drifting behind Gitea/local.
2. **Sync GitHub `main`** — decide whether GitHub is meant to mirror Codeberg 1:1; if so, push the 4 missing commits once credentials/policy are confirmed.
3. **Add `claro validate` and `python3 tools/validate_typecheck_diagnostics.py` to `.forgejo/workflows/ci.yml`**, so the 33-fixture typecheck matrix is actually gated in CI, not just run manually. This is a small, low-risk, high-value change.
4. **Continue the object/method diagnostic series along its established pattern** (per `docs/ROADMAP.md` "Near-term cleanup priorities" and the `docs/ADVANCED_STATIC_TYPING.md` "Status" section, both CLAIMED as the project's own stated direction): the next natural narrow slice, following the existing good/bad-fixture-pair convention, would be object-field diagnostics for compound assignment (e.g. `SET player.score player.score + 5`) or a return-type check for simple methods — both currently listed as "still needed" in `docs/CURRENT_STATUS.md`. This keeps scope narrow and consistent with the last 5 commits' style (one fixture pair + one diagnostic branch + doc sync per commit).
5. **Consider a low-risk refactor of `typecheck_file()`** into named per-statement-kind helper functions (e.g. `typecheck_set_statement`, `typecheck_call_statement`, `typecheck_check_type_statement`) before adding much more branching — purely mechanical extraction, same behavior, verified by the existing fixture suite, to keep the "one more `if` per feature" pattern from becoming unreviewable.
---
## 9. Precise review questions for GPT-5.6-Luna
1. **Push blocker**: Given `origin` (Codeberg) is 1 commit behind and the failure mode was HTTPS credential rejection (not network unreachability — this session's `git fetch origin main` succeeded), do you see evidence of a token scope/expiry issue versus a repo-permission issue? Is there a safer non-interactive re-auth path than the askpash script previously used?
2. **Remote policy**: Should GitHub `main` be treated as a required mirror of Codeberg `main`, or is its 4-commit staleness intentional (e.g. GitHub kept as a pre-migration snapshot, given the branch name `backup/github-main-before-codeberg-copy-20260717-185100` visible in `git branch -a`)? This affects whether "sync GitHub" belongs on the task list at all.
3. **CI coverage gap**: Do you agree `claro validate` and `tools/validate_typecheck_diagnostics.py` should be added to `.forgejo/workflows/ci.yml`, or is there a reason (e.g. runtime cost, redundancy with `claro test`) they were deliberately left out?
4. **`typecheck_file()` density**: Is the one-line-per-statement-kind style in `src/claro.c` (confirmed at `typecheck_file()`, `src/claro.c:550`, and `run_validate()`, `src/claro.c:639`) an intentional project convention (e.g. to minimize diff noise or match some formatting tool), or tech debt worth breaking up now, before the object/method diagnostic series grows further? If intentional, what's the constraint driving it?
5. **Committed binaries**: Given `claro`/`claro.exe` are `.gitignore`d yet tracked and currently reproducible byte-for-byte from source (verified this session), should they be removed from tracking (relying on CI/Makefile to build), or is committing them load-bearing for some consumer (e.g. `claro new`/docs referencing a ready-to-run binary without requiring a local `gcc`)?
6. **Next diagnostic slice**: Does compound field assignment (`SET player.score player.score + 5`) or method-return-type checking better match the project's actual near-term priority, or is there a different "still needed" item from `docs/CURRENT_STATUS.md` you'd rank higher given the codebase as it stands today?
---
## 10. Review addendum — 2026-08-17 (re-verification pass, by Claude)
A second, independent pass was run in this same checkout shortly after the handoff above was written (handoff file mtime `2026-08-17 00:17:15 UTC`; this addendum's checks ran at `2026-08-17 00:18–00:20 UTC`, i.e. minutes later, same day/session window — not a later-day re-check). Purpose: confirm every claim in §1–§9 still holds before handing off, and record exact commands/output for Luna. **No source files were modified, nothing was committed, pushed, or deleted.** `CODEBERG_PUSH_HANDOFF.md` was read only, left byte-identical.
### Commands run and results (all VERIFIED, this pass)
```
$ git status
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
Untracked: CODEBERG_PUSH_HANDOFF.md, HANDOFF_GPT56_LUNA.md
```
→ Same as §2, with `HANDOFF_GPT56_LUNA.md` now also untracked (it did not exist yet when §2 was written).
```
$ git log --oneline -5
1cbdc1e feat: diagnose unknown object methods
40f7881 feat: diagnose method calls before object creation
a3c084b feat: improve unknown object field expression diagnostic
c41d255 feat: diagnose object field assignment before NEW
68104bd feat: diagnose missing object field type checks
```
→ Unchanged from §1/§2. `git log -1 --format='%H %ci'` confirms `HEAD` is `1cbdc1e`, authored `2026-08-13 15:30:33 +0000` — no new commits landed between the two passes.
```
$ git fetch origin main && git fetch gitea main && git fetch github main
```
→ All three succeeded (read-only). Ref comparison:
- `origin/main` (Codeberg) = `40f7881` — still 1 commit behind local `HEAD`. **Codeberg push blocker is unchanged/unresolved.**
- `gitea/main` = `1cbdc1e` — still identical to local `HEAD`.
- `github/main` = `68104bd` — still 4 commits behind local `HEAD`.
This exactly reproduces §2's numbers. `git branch -a` also still shows `remotes/github/backup/github-main-before-codeberg-copy-20260717-185100`, corroborating §9 Q2's observation that GitHub may be an intentional pre-migration snapshot rather than a required mirror.
```
$ gcc -std=c99 -O0 src/claro.c -o /tmp/claro_build_review -lm
```
→ Exit 0. Same three `-Wformat-truncation` warnings in `create_package_folder()` (`src/claro.c:587`, on the `path`/`meta`/`readme` `snprintf` calls), verbatim to §4/§5 item 4. No new warnings, no errors.
```
$ cmp /tmp/claro_build_review ./claro
```
→ **Identical**, confirming the tracked binary is still byte-for-byte reproducible from `HEAD`.
```
$ ./claro --version
```
→ `Claro v1.18.26` — unchanged.
```
$ ./claro test
```
→ `PASS: 0 failure(s)`.
```
$ ./claro validate
```
→ Full doctor + test + example-check + typecheck good/bad matrix, ending `Validation passed. Claro v1.18.26 foundation checks are ready for use.`
```
$ python3 tools/validate_typecheck_diagnostics.py
```
→ Exit 0, `Typecheck diagnostics validation complete`, same fixture set including the two newest method-diagnostic fixtures.
```
$ ./claro doctor
```
→ All `OK`, `Claro folder looks ready.`
```
$ ./claro check examples/quiz.claro && make check
```
→ All four checks (`quiz.claro`, `01_hello.claro`, `03_variables.claro`, `08_functions.claro`) `OK`.
```
$ ./claro typecheck tests/typecheck_method_unknown_method_bad.claro
```
→ `tests/typecheck_method_unknown_method_bad.claro:11: Object Player has no method fly. Check the method name or add TEACH fly inside CLASS Player.` (exit 1, as expected).
```
$ cat .forgejo/workflows/ci.yml
```
→ Confirmed: CI runs `make`, `./claro test`, three lesson `claro check` calls, and `tools/validate_rc3.py` only. It does **not** run `claro validate` or `tools/validate_typecheck_diagnostics.py`. §5 item 6's CI coverage gap is confirmed still present, unchanged.
```
$ cat .gitignore
```
→ Still lists `claro` and `claro.exe` alongside `*.o`, `*.obj`, `*.out`, `.DS_Store`, `Thumbs.db` — both tracked-yet-ignored binaries remain as described in §3/§5 item 3.
```
$ git status --porcelain | grep '^??'
```
→ `CODEBERG_PUSH_HANDOFF.md` and `HANDOFF_GPT56_LUNA.md` only, before and after all commands above — no stray files (`packages/`, `MyProject/`, etc.) left behind by any test/validate run.
Also re-read `docs/CURRENT_STATUS.md` (Static type safety and Objects/classes sections) and `docs/ROADMAP.md` ("Near-term cleanup priorities" and "Complete-platform milestones §1–2"): both still list "broader object field checking beyond simple direct assignments," "method return typing," and "type checking through branches and loops" as still-needed — consistent with, and directly supporting, §8 item 4's recommendation. No doc changes since the original handoff was written.
### Facts that changed between the two passes
None. Branch state, remote divergence, binary reproducibility, all test/validate results, CI workflow contents, and `.gitignore` contents are identical to what §1–§9 already documented. The only diff is that `HANDOFF_GPT56_LUNA.md` itself now exists as a second untracked file (it was being written during §2's snapshot).
### Newly discovered risks (from this pass)
- None beyond what §5/§6 already capture. One clarification worth flagging explicitly for Luna: **both untracked handoff files (`CODEBERG_PUSH_HANDOFF.md`, `HANDOFF_GPT56_LUNA.md`) currently exist only in this local checkout.** Since they're untracked, they will not survive being lost if this checkout is discarded, and they are not visible on any of the three remotes. If this handoff's contents are meant to persist beyond this machine, they need to be committed (as a deliberate, human-approved action — not done in this session) or copied out manually.
### Recommended next task for Luna (unchanged from §8, re-confirmed)
The priority order in §8 still holds exactly as written:
1. Resolve the Codeberg push credential issue (human/credential-owner action, still blocking `origin/main` by 1 commit).
2. Decide GitHub's intended relationship to Codeberg (mirror vs. intentional pre-migration snapshot) before treating its 4-commit staleness as a bug.
3. Add `claro validate` and `tools/validate_typecheck_diagnostics.py` to `.forgejo/workflows/ci.yml` — still a small, low-risk, high-value gap, re-confirmed present this pass.
4. Continue the object/method diagnostic series — object-field checking for compound assignment or method-return-type checking are the best-supported next slices per the current `docs/CURRENT_STATUS.md`/`docs/ROADMAP.md` wording, re-read and re-confirmed this pass.
5. Consider extracting `typecheck_file()` (`src/claro.c:550`) into named per-statement helpers before the diagnostic series grows further — still purely mechanical, still unattempted.
No new task was surfaced by this re-verification pass; its purpose was confidence, not discovery. Luna can treat §1–§9 as current as of `2026-08-17`, not stale.
+4 -1
View File
@@ -2,11 +2,14 @@ CC = gcc
CFLAGS = -std=c99 -O0 CFLAGS = -std=c99 -O0
LDFLAGS = -lm LDFLAGS = -lm
all: claro all: claro claro.exe
claro: src/claro.c claro: src/claro.c
$(CC) $(CFLAGS) -o claro src/claro.c $(LDFLAGS) $(CC) $(CFLAGS) -o claro src/claro.c $(LDFLAGS)
claro.exe: src/claro.c
$(CC) $(CFLAGS) -o claro.exe src/claro.c $(LDFLAGS)
test: claro test: claro
./claro test ./claro test
+233 -5
View File
@@ -10,6 +10,8 @@ Claro stays plain-text first: simple enough to start with `SET name "Jon"`, but
**Current release:** Claro v1.18.26 **Current release:** Claro v1.18.26
For the current feature map and beginner-safe limits, start with [`docs/CURRENT_STATUS.md`](docs/CURRENT_STATUS.md). The sequenced development priorities are in [`docs/ROADMAP.md`](docs/ROADMAP.md); older release-candidate notes are historical.
Validated in this package: Validated in this package:
```bash ```bash
@@ -21,8 +23,17 @@ Validated in this package:
./claro validate ./claro validate
# Validation passed. Claro v1.18.26 networking reliability is ready for use. # Validation passed. Claro v1.18.26 networking reliability is ready for use.
python3 tools/validate_typecheck_diagnostics.py
python3 tools/validate_ide_metadata.py
python3 tools/validate_version_convention.py
python3 tools/validate_package_security.py
python3 tools/validate_compiler_warnings.py
python3 tools/validate_ci_workflow.py
``` ```
The CI workflow validator also requires its own command to remain in an executable `run` step, so the release-gate check cannot silently disappear from CI. `make` builds both `claro` and `claro.exe`, allowing the version validator to exercise the same source build on every platform.
## Beginner-first syntax ## Beginner-first syntax
Claro accepts both the sentence-like style and the shorter simple style: Claro accepts both the sentence-like style and the shorter simple style:
@@ -84,6 +95,7 @@ END
NEW Player player NEW Player player
SET player.name "Jon" SET player.name "Jon"
SET player.score 10 SET player.score 10
SET player.score player.score + 1
DO player.show DO player.show
DO player.add 5 DO player.add 5
@@ -97,6 +109,17 @@ OBJECT CLASS player AS kind
OBJECT FIELDS player AS fields OBJECT FIELDS player AS fields
``` ```
When a script already declares classes, `claro typecheck` also catches a typo in a `NEW` class name and explains how to repair it:
```text
Class Plaeyr is not known yet. Check the class name or declare CLASS Plaeyr before creating player.
```
Inside a method, an inline field type must agree with the class declaration. For example, `HAS score NUMBER` must not be assigned with `SET score TEXT 10`; `claro typecheck` explains the conflict and suggests `NUMBER`. The same check applies to older `TEACH ... TAKES ...` / `LEARNED` methods, so compatibility lessons get the same feedback.
If an inline method-field annotation is not a Claro type, `claro typecheck` names the field and method and suggests the class declaration. For example, `SET score AS BANANA TO 10` reports that `BANANA` is unknown and recommends `NUMBER`.
The same diagnostic is covered for older `TEACH ... TAKES ...` / `LEARNED` methods, so compatibility lessons do not silently accept misspelled field types.
## Static type safety ## Static type safety
Beginners can still write the simplest form: Beginners can still write the simplest form:
@@ -118,6 +141,72 @@ SAY kind
CHECK TYPE score IS NUMBER CHECK TYPE score IS NUMBER
``` ```
`CHECK TYPE` gives a direct repair hint when `IS` is missing:
```text
CHECK TYPE needs IS. Try: CHECK TYPE score IS NUMBER.
```
If extra words follow the result name, `claro typecheck` explains that `TYPE OF` accepts one expression, `AS`, and one result name:
```text
TYPE OF score AS kind extra
TYPE OF score has extra text after result name kind. Keep only the expression, AS, and one result name.
```
If the learner leaves out the expression as well, the checker explains all three required parts:
```text
CHECK TYPE needs an expression, IS, and a type. Try: CHECK TYPE score IS NUMBER.
```
If `IS` is present but the expression is missing, Claro points out that the expression belongs before `IS`:
```text
CHECK TYPE needs an expression before IS. Try: CHECK TYPE score IS NUMBER.
```
`TYPE OF` also explains when the result variable is missing its `AS` keyword:
```text
TYPE OF needs AS. Try: TYPE OF score AS kind.
```
If the learner writes `IS` but leaves out the expected type, Claro names the missing piece and shows a complete example:
```text
CHECK TYPE score needs a type after IS. Try: CHECK TYPE score IS NUMBER.
```
If extra words follow the expected type, `claro typecheck` explains that only one type belongs there:
```text
CHECK TYPE score IS NUMBER TEXT
CHECK TYPE score has extra text after type NUMBER. Keep only the expression, IS, and one type.
```
If `RETURNS` is present without a type, `claro typecheck` explains what is missing and shows a beginner-friendly repair:
```text
Function greet needs a return type after RETURNS. Add a type such as NUMBER.
```
The same missing-type check covers the older `TEACH ... TAKES ... RETURNS` / `LEARNED` spelling, so compatibility lessons receive the same repair instead of silently accepting an incomplete return declaration.
The same repair applies to object methods and older compatibility methods, and names the class so the learner can find the declaration:
```text
Method Player.score needs a return type after RETURNS. Add a type such as NUMBER.
```
An empty typed `RETURN` is also rejected in both modern and compatibility functions and methods. Add an expression of the declared type, such as `RETURN amount` for a `NUMBER` return.
`CHECK TYPE` names a real Claro type. If a type name is misspelled, the checker explains the allowed beginner types instead of reporting a confusing value mismatch:
```text
CHECK TYPE score IS BANANA
CHECK TYPE needs a known type such as NUMBER, TEXT, YESNO, LIST, or MAP, but BANANA is not a Claro type.
```
Advanced container checks are available through `claro typecheck`: Advanced container checks are available through `claro typecheck`:
```claro ```claro
@@ -128,7 +217,7 @@ SET scores AS MAP OF NUMBER TO MAP
PUT scores KEY "math" VALUE 98 PUT scores KEY "math" VALUE 98
``` ```
`claro typecheck` also has an early function-argument diagnostic foundation. A function can state a parameter expectation with `CHECK TYPE`, and calls with the wrong value type get a friendly error: `claro typecheck` also has an early function-argument diagnostic foundation. A function can state a parameter expectation with `CHECK TYPE`, and calls with the wrong value type or a missing checked argument get a friendly error:
```claro ```claro
TEACH square amount TEACH square amount
@@ -141,8 +230,86 @@ DO square "oops"
```text ```text
Type mismatch for function square: parameter amount needs NUMBER, but this argument looks like TEXT. Type mismatch for function square: parameter amount needs NUMBER, but this argument looks like TEXT.
Function square needs argument amount as NUMBER, but this call does not provide it.
Function greet needs 1 argument, but this call gives 0. Add the missing argument.
Function square only accepts 1 argument, but this call gives 2. Remove the extra argument.
Function squre is not known yet. Check the function name or add TEACH squre before calling it.
``` ```
If a function repeats a parameter name, `claro typecheck` reports the declaration mistake before the function is called. This applies to both modern `END` functions and compatibility `TAKES` / `LEARNED` functions:
```text
Function greet declares parameter name more than once. Give each parameter a different name.
```
Top-level functions must also have unique names. If a script declares `TEACH greet` twice, `claro typecheck` reports `Function greet is declared more than once. Give each function a different name.` Rename one function before calling it. A function declaration must include a name; writing only `TEACH` reports `TEACH needs a function name. Add a name after TEACH, such as TEACH greet.` Inside `CLASS Player`, the same mistake reports `Method Player needs a method name. Add a name after TEACH, such as TEACH show.`
The same declaration check applies to object methods in both syntax styles. For example, `TEACH greet name, name` inside `CLASS Player` reports `Method Player.greet declares parameter name more than once. Give each parameter a different name.` Duplicate method names are also rejected in both modern `END` methods and compatibility `TAKES` / `LEARNED` methods, with a rename hint before a call can become ambiguous.
Object methods must also have unique names within their class. If `CLASS Player` declares `TEACH show` twice, `claro typecheck` reports `Method Player.show is declared more than once. Give each method a different name.` Rename one method before calling it.
Class fields must also have unique names and known types. If `CLASS Player` declares `HAS score NUMBER` twice, or declares the same field with another type, `claro typecheck` reports `Class Player declares field score more than once. Give each field a different name.` A bare `HAS` reports `Class Player needs a field name. Add a name and type after HAS, such as HAS score NUMBER.` If a field omits its type, it reports `Class Player field score is missing a type. Add a type such as NUMBER, TEXT, YESNO, LIST, or MAP after the field name.` If a field uses an unknown type such as `BANANA`, it reports `Class Player field score uses an unknown type BANANA. Use a Claro type such as NUMBER, TEXT, YESNO, LIST, or MAP.` If extra text follows a valid type, it reports `Class Player field score has extra text after type NUMBER. Keep only the field name and one type.` Keep one `HAS` line for each field and use one supported type.
Class declarations must include a name. A bare `CLASS` reports `CLASS needs a class name. Add a name after CLASS, such as CLASS Player.` Class names must also be unique and use one name only. If a file declares `CLASS Player` twice, `claro typecheck` reports `Class Player is declared more than once. Give each class a different name.` If extra words follow the name, it reports `Class Player has extra text after its name. Keep only the class name after CLASS.` Rename or simplify the declaration before creating its objects. Object names must also be unique within a script: creating `NEW Player player` twice reports `Object player is created more than once. Give each object a different name.` Use a different object name for the second instance. A `NEW` declaration must include both a class name and an object name; bare `NEW` reports `NEW needs a class name. Add a class and object name, such as NEW Player player.`, while `NEW Player` reports `NEW Player needs an object name. Add a name after the class, such as NEW Player player.`
Extra words after an object name are also rejected, for example `NEW Player player extra` reports `NEW Player has extra text after object name player. Keep only the class and object names.` Keep each `NEW` declaration to one class name and one object name.
Simple functions and object methods can also declare a return type. `claro typecheck` checks each `RETURN` expression against it and reports a missing return when a declaration never returns a value:
```claro
TEACH square amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount
END
```
The same focused check applies to methods such as `Player.score RETURNS NUMBER`; a wrong return reports the full method name, for example: `Type mismatch for return from Player.score: expected NUMBER, but this value looks like TEXT.`
The older compatibility spelling keeps the same return check for functions and methods. For example, `TEACH square TAKES amount RETURNS NUMBER` with `LEARNED` and `CALL square WITH 4` is checked before it runs, so older lessons get the same type-safety feedback. A compatibility method such as `TEACH score TAKES amount RETURNS NUMBER` inside a class is checked the same way; a correct `CALL player.score WITH 4` path is covered by release validation too.
If a function or method declares `RETURNS TYPE` but uses `RETURN` without a value, the checker points out the missing expression:
```text
Function square needs a NUMBER value after RETURN. Add a NUMBER expression.
```
The same repair applies to compatibility methods written with `TAKES` / `LEARNED`, so older lessons also receive a method-specific hint instead of a generic type error.
If a return value has extra space-separated text, `claro typecheck` identifies the first value and explains that `RETURN` accepts one expression:
```claro
TEACH square amount RETURNS NUMBER
RETURN amount extra
END
```
```text
Function square has extra text after return value amount. Keep only one expression after RETURN.
```
The same focused repair applies to modern and compatibility object methods, and names the complete method such as `Player.total`.
Compatibility functions using `TAKES` / `LEARNED` receive the same repair when a return value has extra text. For example, `RETURN amount extra` reports `Function square has extra text after return value amount. Keep only one expression after RETURN.`
If a function or method declares `RETURNS TYPE` but contains no `RETURN`, the checker points out the missing statement:
```text
Function square declares RETURNS NUMBER but has no RETURN statement. Add RETURN with a NUMBER value.
```
Return declarations must use a known Claro type. If the type name is misspelled, the checker explains the supported beginner types:
```text
Function square declares an unknown return type BANANA. Use a Claro type such as NUMBER, TEXT, YESNO, LIST, or MAP.
```
The same check applies to methods, so `Player.score RETURNS BANANA` reports `Method Player.score declares an unknown return type BANANA...` instead of allowing a misspelled type into a class definition. If a return expression cannot be understood yet, the diagnostic names the function or method and the type it needs; this is covered for both modern and older compatibility method syntax. When a NUMBER return contains a known TEXT operand in arithmetic, the checker names the operation and operand, for example: `Type mismatch for return from total: addition needs NUMBER values, but "oops" looks like TEXT.` Complete `IF`/`ELSE` return branches are also accepted inside typed functions and methods, including a nested conditional whose own branches all return; an incomplete path still gets a missing-return diagnostic.
The same return diagnostic names the arithmetic operation when a NUMBER return mixes in a known TEXT operand, so the learner sees both the operation rule and the offending value instead of only a generic return mismatch. This is covered for addition, subtraction, multiplication, and division in functions and object methods. For example, `Player.total` reports `subtraction needs NUMBER values` when its return expression mixes a checked NUMBER parameter with a TEXT value.
Claro keywords are case-insensitive here, so `returns NUMBER` is accepted as the same return declaration as `RETURNS NUMBER`. The type checker keeps the return-value diagnostic when a lowercase declaration is used, which helps learners who are still learning Claro's capitalization style.
The unknown-function diagnostic is validated for both modern `DO squre 4` and compatibility `CALL squre WITH 4` calls. Compatibility calls that leave `WITH` empty, such as `CALL greet WITH`, now count as zero arguments, so learners get the same missing-argument guidance as `DO greet` instead of the checker treating the blank as an argument.
For functions with more than one checked parameter, Claro reports each mismatched argument with the parameter name: For functions with more than one checked parameter, Claro reports each mismatched argument with the parameter name:
```claro ```claro
@@ -154,7 +321,7 @@ END
CALL label WITH 7, "old" CALL label WITH 7, "old"
``` ```
The same narrow diagnostic foundation now covers simple object method calls when the object was created with `NEW` and the method body uses `CHECK TYPE` for a parameter. Correct calls such as `DO player.add 5` are covered by validation, and wrong-type calls get a focused learner-facing error: The same narrow diagnostic foundation now covers simple object method calls when the object was created with `NEW` and the method body uses `CHECK TYPE` for a parameter. Correct calls such as `DO player.add 5` and compatibility calls such as `CALL player.add WITH 5` are covered by validation, and wrong-type calls get a focused learner-facing error. This also works when the checked method appears after another method in the same class, so normal multi-method class examples still get the same wrong-type and extra-argument guidance:
```claro ```claro
CLASS Player CLASS Player
@@ -168,19 +335,30 @@ END
NEW Player player NEW Player player
DO player.add "five" DO player.add "five"
CALL player.add WITH "five"
``` ```
```text ```text
Type mismatch for method Player.add: parameter points needs NUMBER, but this argument looks like TEXT. Type mismatch for method Player.add: parameter points needs NUMBER, but this argument looks like TEXT.
Method Player.add needs argument points as NUMBER, but this call does not provide it.
Method Player.rename needs 1 argument, but this call gives 0. Add the missing argument.
Method Player.add only accepts 1 argument, but this call gives 2. Remove the extra argument.
``` ```
If a learner calls a simple object method before creating the object with `NEW`, `claro typecheck` now points to the missing setup instead of letting the dotted call look like an ordinary unknown function: If a learner calls a simple object method before creating the object with `NEW`, `claro typecheck` now points to the missing setup instead of letting the dotted call look like an ordinary unknown function. This covers both the modern `DO player.add 5` form and the older compatibility `CALL player.add WITH 5` form, including `CALL` mistakes where the method name itself is wrong:
```text ```text
Object player is not known yet. Create it with NEW ClassName player before calling player.add. Object player is not known yet. Create it with NEW ClassName player before calling player.add.
Object player is not known yet. Create it with NEW ClassName player before calling player.fly.
``` ```
For simple object fields created with `NEW Class name`, `claro typecheck` also catches direct wrong-type field assignments such as `SET player.score "ten"` when the class says `HAS score NUMBER`: If the object exists but the class does not declare that method, Claro now names the class and suggests where to add the missing `TEACH` block. This is validated for both modern `DO player.fly 5` and compatibility `CALL player.fly WITH 5` calls:
```text
Object Player has no method fly. Check the method name or add TEACH fly inside CLASS Player.
```
For simple object fields created with `NEW Class name`, `claro typecheck` also catches direct wrong-type field assignments such as `SET player.score "ten"` when the class says `HAS score NUMBER`. This remains true if the `HAS` field appears after a simple method in the class, so learners get the field-type error instead of a misleading unknown-field hint:
```text ```text
Type mismatch for field player.score: expected NUMBER, but this value looks like TEXT. Type mismatch for field player.score: expected NUMBER, but this value looks like TEXT.
@@ -192,6 +370,38 @@ It also catches direct assignments to undeclared fields and suggests the matchin
Object Player has no field level. Check the field name or add HAS level NUMBER to the class. Object Player has no field level. Check the field name or add HAS level NUMBER to the class.
``` ```
The same field check follows a simple object alias. After `SET alias player`, assignments through `alias.score` still use the field type declared by `Player`:
```claro
NEW Player player
SET alias player
SET alias.score "ten"
```
```text
Type mismatch for field alias.score: expected NUMBER, but this value looks like TEXT.
```
The same check follows simple arithmetic and text-concatenation expressions. For example, `SET player.score player.name + 1` now names the text operand and explains that addition into a `NUMBER` field needs numeric values, rather than silently accepting an expression whose result cannot fit the field.
The checker identifies text operands in arithmetic expressions and explains the operator rule instead of treating an invalid numeric field assignment as an unknown expression:
```text
Type mismatch for field player.score: subtraction needs NUMBER values, but player.name looks like TEXT.
Type mismatch for field player.score: addition needs NUMBER values, but player.name looks like TEXT.
Type mismatch for field player.score: multiplication needs NUMBER values, but player.name looks like TEXT.
Type mismatch for field player.score: division needs NUMBER values, but player.name looks like TEXT.
```
Valid numeric subtraction is covered too:
```claro
SET player.score 10
SET player.score player.score - 2
```
The focused typecheck validation keeps this valid subtraction example beside the existing valid multiplication and division examples, so a useful expression is not confused with a nearby text-operand mistake.
TEXT-valued and YESNO-valued field-name mistakes are validated too: TEXT-valued and YESNO-valued field-name mistakes are validated too:
```text ```text
@@ -241,6 +451,10 @@ The same missing-object guidance is now validated for direct field assignment be
Object player is not known yet. Create it with NEW ClassName player before setting player.score. Object player is not known yet. Create it with NEW ClassName player before setting player.score.
``` ```
The checker also names typed method-body field checks and assignments. Inside `Player.rename`, `CHECK TYPE name IS NUMBER` reports `Type check failed in Player.rename: expected NUMBER, but name looks like TEXT.` Inside `Player.add RETURNS NUMBER`, `SET score score + name` reports `Type mismatch for field score in Player.add: addition needs NUMBER values, but name looks like TEXT.` The same metadata check is covered for compatibility `TAKES` / `LEARNED` methods with YESNO fields, so `CHECK TYPE ready IS TEXT` reports `Type check failed in Player.toggle: expected TEXT, but ready looks like YESNO.` The learner sees that the field belongs to the current class method, not an unrelated variable.
The release validator also runs the modern and compatibility method-body field diagnostic fixtures, including `CHECK TYPE` checks in older `TAKES` / `LEARNED` methods, so these learner-facing errors remain part of `claro validate`, not only the standalone typecheck diagnostic script.
## Project and package workflow ## Project and package workflow
v1.18.26 hardens Claro's project/package workflow. v1.18.26 hardens Claro's project/package workflow.
@@ -272,7 +486,21 @@ claro.lock
packages/ packages/
``` ```
Package names are checked so unsafe names such as `../bad` are rejected. `claro package doctor` also checks that every listed package has a manifest whose
`name:` matches the package name in `claro.project`; a mismatch is reported as
`BAD package manifest name` instead of being treated as a healthy package.
It also compares the complete `checksum:` field, so extra or trailing checksum
text, or a duplicate checksum field, is rejected as `BAD package checksum`.
Package manifests must contain exactly one `version: 1` field; duplicate or
prefix-matching values such as `version: 10` are rejected as `BAD package version`.
The project manifest must contain exactly one `manifest-version: 1` field; duplicate
or prefix-matching values such as `manifest-version: 10` are rejected as
`BAD project manifest version: expected 1`. It must also contain exactly one non-empty `name:` field;
otherwise doctor reports `BAD project manifest name: expected a non-empty name`.
Starter projects created with `claro new MyProject` use the same `manifest-version: 1` and `lock-version: 1` headers as `claro package init`, so the first project files match the package maintenance tools.
Project names and package names are checked so unsafe names such as `../bad` are rejected before Claro creates folders. Names must also be 64 characters or fewer, which keeps generated project and package paths predictable. If an unsafe package name is already present in `claro.project`, `claro package doctor`, `claro package lock`, `claro package list`, `claro package init`, `claro package add`, and lockfile refreshes during `claro package remove` flag it instead of treating it as safe lockfile data. `claro package remove` can also remove the exact unsafe entry, so a learner can repair a bad project file without Claro using that unsafe name as a folder path. `claro package doctor` also verifies listed package lockfile checksums, reports stale lock entries, and rejects lockfile package entries that are not listed in `claro.project`.
## Standard-library path and collection helpers ## Standard-library path and collection helpers
+686 -3
View File
@@ -2,6 +2,26 @@
Claro v1.18.26 adds the first advanced static-typing foundation: typed containers checked by `claro typecheck`. Claro v1.18.26 adds the first advanced static-typing foundation: typed containers checked by `claro typecheck`.
## Complete `TYPE OF` statements
`TYPE OF` needs an expression, `AS`, and a result name. If the expression is missing, `claro typecheck` gives a repair example instead of silently creating the result variable:
```claro
TYPE OF AS kind
```
```text
TYPE OF needs an expression before AS. Try: TYPE OF score AS kind.
```
Add the value whose type should be stored, such as `TYPE OF score AS kind`.
Class fields need a type after the field name. If a learner writes `HAS score` instead of `HAS score NUMBER`, `claro typecheck` explains the missing piece:
```text
Class Player field score is missing a type. Add a type such as NUMBER, TEXT, YESNO, LIST, or MAP after the field name.
```
## Typed lists ## Typed lists
```claro ```claro
@@ -43,6 +63,472 @@ Output:
Type mismatch for map scores: expected NUMBER value, but this value looks like TEXT. Type mismatch for map scores: expected NUMBER value, but this value looks like TEXT.
``` ```
## Nested container values
A typed list can contain a typed map. `claro typecheck` keeps the map's own type metadata while checking the outer list:
```claro
SET people AS LIST OF MAP TO LIST
SET person AS MAP OF TEXT TO MAP
PUT person KEY "name" VALUE "Ada"
ADD person TO people
```
This is accepted with `Type check OK`. More complex nested container operations and full key/value inference remain future work.
## Unknown fields inside methods
When a method assigns a known value to a bare name that is not a parameter, local variable, or declared class field, `claro typecheck` reports the missing field instead of silently treating the typo as a new variable:
```claro
CLASS Player
HAS score NUMBER
TEACH train
SET level 3
END
END
```
The diagnostic is:
```text
Object Player has no field level. Check the field name or add HAS level NUMBER to the class.
```
This narrow check covers direct method assignments with a known expression in both modern `TEACH ... END` and compatibility `TEACH ... TAKES ... LEARNED` methods. The focused validation matrix keeps matching positive NUMBER, TEXT, and YESNO assignments in both syntax generations, including `SET ready value` followed by `DO player.toggle YES`. Broader local-variable and control-flow analysis remains future work.
## Compatibility conditional returns
The same every-path return check applies to older `TAKES` / `LEARNED` functions. If one branch returns but the other branch does not, `claro typecheck` explains how to repair both paths:
```claro
TEACH choose TAKES flag RETURNS NUMBER
IF flag
RETURN 1
END
LEARNED
```
```text
Function choose declares RETURNS NUMBER but does not return a NUMBER value on every path. Add RETURN to each branch or after the conditional.
```
Use `ELSE` with a `RETURN` value, or add a return after the conditional. This compatibility example is part of the focused release validation matrix.
A complete compatibility conditional is accepted when both branches return the declared type:
```claro
TEACH choose TAKES flag RETURNS NUMBER
IF flag
RETURN 1
ELSE
RETURN 2
END
LEARNED
```
This positive `TAKES` / `LEARNED` example is checked by both the focused typecheck validator and `claro validate`.
## Complete conditional returns
### Return expressions that need more information
When a typed function or method returns a name or expression whose type the focused checker cannot infer yet, `claro typecheck` reports that clearly instead of silently accepting it:
```claro
TEACH square amount RETURNS NUMBER
RETURN missing
END
```
```text
Function square's return value could not be understood yet. Use a NUMBER expression after RETURN.
```
Use a known typed value, such as a parameter checked with `CHECK TYPE`, while broader expression inference remains future work.
The same learner-facing diagnostic applies to compatibility functions written with `TAKES` / `LEARNED`, so older lessons do not get a less-helpful error when a return expression is still unknown.
Known NUMBER parameters can also be used in arithmetic return expressions. Numeric division is accepted when both operands are known numbers:
```claro
TEACH halve amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount / 2
END
```
This valid division case is included in the focused typecheck validation matrix beside the diagnostic for using a TEXT operand in division.
Subtraction follows the same rule:
```claro
TEACH difference amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount - 2
END
```
The focused validator checks this positive function case as well as the matching subtraction diagnostic for a TEXT operand.
The same protection applies to object methods. A checked NUMBER parameter can be divided by a number and returned as NUMBER:
```claro
CLASS Player
TEACH total amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount / 2
END
END
```
This valid method-division case is included in the focused typecheck validation matrix beside the method diagnostic for using a TEXT operand in division.
Return declarations accept the same case-insensitive keyword style as the rest of Claro. For example, `returns NUMBER` still enables return checking:
```claro
TEACH square amount returns NUMBER
RETURN "oops"
END
```
This reports a normal return mismatch naming `NUMBER` and `TEXT`; capitalization style does not disable the safety check.
The same case-insensitive return declaration rule applies to compatibility methods. A lowercase `returns` still checks the method's `RETURN` value:
```claro
CLASS Player
TEACH score TAKES amount returns NUMBER
RETURN "oops"
LEARNED
END
```
`claro typecheck` reports:
```text
Type mismatch for return from Player.score: expected NUMBER, but this value looks like TEXT.
```
A correct compatibility call also remains valid when the declaration uses lowercase `returns`:
```claro
NEW Player player
CALL player.score WITH 4
```
This success path is included in the focused typecheck validation matrix.
Compatibility methods also keep arithmetic return checks when they use the older
`TAKES` / `LEARNED` spelling. For example, this checked division remains a valid
NUMBER return:
```claro
CLASS Player
TEACH score TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount / 2
LEARNED
ENDCLASS
```
This matching `CALL player.score WITH 4` path is included in focused validation.
The same compatibility method return check explains an addition mistake instead of
falling back to a generic return error:
```claro
CLASS Player
TEACH total TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount + "oops"
LEARNED
ENDCLASS
```
`claro typecheck` reports:
```text
Type mismatch for return from Player.total: addition needs NUMBER values, but "oops" looks like TEXT.
```
This negative compatibility fixture is part of focused release validation.
Compatibility methods support numeric subtraction in the same focused way:
```claro
CLASS Player
TEACH score TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount - 2
LEARNED
ENDCLASS
```
The matching `CALL player.score WITH 4` success path is included in focused validation alongside the modern method subtraction case.
Compatibility methods also keep numeric multiplication return checks. This older
`TAKES` / `LEARNED` spelling accepts a checked NUMBER parameter multiplied by a
number and returned as NUMBER:
```claro
CLASS Player
TEACH score TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount * 2
LEARNED
ENDCLASS
```
The matching `CALL player.score WITH 4` success path is included in focused validation.
Compatibility method division mistakes receive the same operation-specific guidance:
```claro
CLASS Player
TEACH total TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount / "oops"
LEARNED
ENDCLASS
```
`claro typecheck` reports:
```text
Type mismatch for return from Player.total: division needs NUMBER values, but "oops" looks like TEXT.
```
This negative compatibility fixture is part of focused release validation.
When a function declares a return type, `claro typecheck` accepts nested conditionals when every branch returns a value of that type:
```claro
TEACH choose flag RETURNS NUMBER
IF flag
IF flag
RETURN 1
ELSE
RETURN 2
END
ELSE
RETURN 3
END
END
```
An incomplete branch still produces a missing-return diagnostic. Deeper control-flow analysis through loops and more complex conditions remains planned.
## Object aliases and field checks
When a simple object is assigned to another variable, `claro typecheck` preserves its class for direct field assignments:
```claro
NEW Player player
SET alias player
SET alias.score 10
```
If the value has the wrong type, the diagnostic names the alias and the expected class field type:
```text
Type mismatch for field alias.score: expected NUMBER, but this value looks like TEXT.
```
This is intentionally limited to simple aliases. Broader object-flow analysis through branches, loops, and complex expressions remains planned.
The same field-assignment check follows a second simple alias. This lets a learner use a more descriptive name without losing the class field type:
```claro
SET backup alias
SET backup.score "ten"
```
Output:
```text
Type mismatch for field backup.score: expected NUMBER, but this value looks like TEXT.
```
This remains limited to direct assignments through simple alias chains; control-flow and complex object-flow analysis are still planned.
Text operands are also identified when they appear in arithmetic expressions assigned to NUMBER fields. The diagnostic names the operator and the text operand, which catches a common beginner mistake such as adding a text field to a number field:
```claro
SET player.score player.name + 1
```
```text
Type mismatch for field player.score: addition needs NUMBER values, but player.name looks like TEXT.
```
Subtraction, multiplication, and division use the same beginner-facing guidance:
```claro
SET player.score player.score - player.name
```
```text
Type mismatch for field player.score: subtraction needs NUMBER values, but player.name looks like TEXT.
```
The same learner-facing result is preserved for multiplication, so the checker does not lose the useful `TEXT` type when the invalid expression uses `*`:
```claro
SET player.score player.score * player.name
```
```text
Type mismatch for field player.score: multiplication needs NUMBER values, but player.name looks like TEXT.
```
Division is covered in the same way:
```claro
SET player.score player.score / player.name
```
```text
Type mismatch for field player.score: division needs NUMBER values, but player.name looks like TEXT.
```
Numeric division remains accepted in a NUMBER field, so the type checker protects both sides of this operator without rejecting a valid beginner expression:
```claro
SET player.score 10
SET player.score player.score / 2
```
This example is included in the focused typecheck validation matrix.
Numeric multiplication is accepted in a NUMBER field as well:
```claro
SET player.score player.score * 2
```
The focused validation matrix keeps this valid arithmetic case beside the multiplication text-operand diagnostic, so a useful expression is not confused with the nearby beginner mistake.
The expression checker now gives operator-specific guidance for known TEXT operands in subtraction, multiplication, and division, including typed method return expressions. Broader expression inference remains future work.
Compatibility methods use the same arithmetic return checks as modern methods. This older spelling is accepted when a checked NUMBER parameter is used in a numeric addition:
```claro
CLASS Player
TEACH score TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount + 2
LEARNED
ENDCLASS
NEW Player player
CALL player.score WITH 4
```
The focused validation matrix covers this positive compatibility example alongside subtraction, multiplication, and division.
The same operator-specific diagnostic is covered for older compatibility methods:
```claro
CLASS Player
TEACH total TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount - "oops"
LEARNED
ENDCLASS
```
Claro reports:
```text
Type mismatch for return from Player.total: subtraction needs NUMBER values, but "oops" looks like TEXT.
```
This keeps `TAKES` / `LEARNED` lessons aligned with the modern method syntax.
Text concatenation is also accepted when the result is assigned to a TEXT field. This keeps a common beginner pattern type-safe without treating every `+` expression as numeric:
```claro
SET player.name player.name + " Lovelace"
```
The focused typecheck validation matrix covers this positive case beside the existing numeric-expression and text-operand checks.
The same rule works when the literal comes first:
```claro
SET player.name "Ada " + player.name
```
This reverse-order concatenation is also covered by focused validation, so learners can build text from either side without losing the declared `TEXT` field type.
Compatibility methods use the same TEXT concatenation rule. The older `TAKES` / `LEARNED` spelling accepts both operand orders when a method updates declared `TEXT` fields:
```claro
TEACH full_name TAKES suffix
SET first first + suffix
SET last "Dr. " + last
LEARNED
```
The focused validation matrix covers this compatibility example too, keeping modern and older method lessons aligned.
Two TEXT fields can be combined as well:
```claro
SET player.name player.name + player.nickname
```
The focused validation matrix covers this field-to-field form so a learner can build text from named object fields without losing the declared `TEXT` type.
`CHECK TYPE` also preserves TEXT field metadata through the same chained aliases:
```claro
CLASS Player
HAS name TEXT
END
NEW Player player
SET alias player
SET backup alias
SET player.name "Ada"
CHECK TYPE backup.name IS TEXT
```
This confirms the declared field type without requiring the learner to repeat the original object variable name. The broader limits are unchanged: aliases created through branches, loops, or complex expressions are still planned.
`CHECK TYPE` also follows simple aliases for direct field metadata checks. This includes a second alias, so learners can give an object a more descriptive local name without losing the class field information:
```claro
NEW Player player
SET alias player
SET alias.score 10
CHECK TYPE alias.score IS NUMBER
```
```claro
SET backup alias
CHECK TYPE backup.score IS NUMBER
```
If the requested type is wrong, the diagnostic names the alias and the declared field type:
```text
Type check failed: expected TEXT, but alias.score looks like NUMBER.
```
The same diagnostic remains specific after the second alias:
```claro
SET backup alias
CHECK TYPE backup.score IS TEXT
```
```text
Type check failed: expected TEXT, but backup.score looks like NUMBER.
```
## Function parameter checks ## Function parameter checks
Claro now has a small static-checking foundation for function arguments. Keep the beginner-friendly function syntax, then put the expected type inside the function with `CHECK TYPE`: Claro now has a small static-checking foundation for function arguments. Keep the beginner-friendly function syntax, then put the expected type inside the function with `CHECK TYPE`:
@@ -73,6 +559,23 @@ Output:
Type mismatch for function square: parameter amount needs NUMBER, but this argument looks like TEXT. Type mismatch for function square: parameter amount needs NUMBER, but this argument looks like TEXT.
``` ```
If the learner forgets a checked argument, `claro typecheck` now names the missing parameter and expected type:
```claro
TEACH square amount
CHECK TYPE amount IS NUMBER
SAY amount
END
DO square
```
Output:
```text
Function square needs argument amount as NUMBER, but this call does not provide it.
```
Multiple checked parameters are reported separately, so a learner can fix each argument one at a time: Multiple checked parameters are reported separately, so a learner can fix each argument one at a time:
```claro ```claro
@@ -93,8 +596,92 @@ Type mismatch for function label: parameter name needs TEXT, but this argument l
Type mismatch for function label: parameter age needs NUMBER, but this argument looks like TEXT. Type mismatch for function label: parameter age needs NUMBER, but this argument looks like TEXT.
``` ```
If a learner mistypes a function name, `claro typecheck` now names the unknown function and suggests either checking the spelling or adding a matching `TEACH` block. This is covered for both modern `DO` and older compatibility `CALL ... WITH` calls:
```claro
TEACH square amount
CHECK TYPE amount IS NUMBER
SAY amount
END
DO squre 4
CALL squre WITH 4
```
Each form reports the same beginner-facing fix:
```text
Function squre is not known yet. Check the function name or add TEACH squre before calling it.
```
## Function and method return checks
Simple functions and object methods can declare a return type with `RETURNS TYPE`. `claro typecheck` checks each simple `RETURN` expression before the program runs. `RETURN` accepts one expression; if a simple value is followed by extra text, the checker gives a repair hint:
```text
Function square has extra text after return value amount. Keep only one expression after RETURN.
```
```claro
CLASS Player
TEACH score amount RETURNS NUMBER
RETURN amount
END
END
NEW Player player
DO player.score 4
```
Returning text from this method produces a learner-facing diagnostic that names the class and method:
```text
Type mismatch for return from Player.score: expected NUMBER, but this value looks like TEXT.
```
If a method's return expression is not understood yet, the diagnostic names the method and gives the promised type so the learner knows what to replace:
```claro
CLASS Player
TEACH square amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN missing
END
END
```
```text
Method Player.square's return value could not be understood yet. Use a NUMBER expression after RETURN.
```
Methods can also return a typed field declared by their class. A field is available by its simple name inside the method, so `RETURN score` is checked against `HAS score NUMBER` instead of being treated as an unknown expression. Returning that field from a method declared `RETURNS TEXT` reports the same expected-versus-found diagnostic.
This is a focused check for simple return expressions. When a parameter has a `CHECK TYPE` declaration, that known type also informs arithmetic return expressions in functions and methods, so `RETURN amount + 1` is checked against the declared return type. The `RETURNS` keyword is case-insensitive in both modern and compatibility function forms, so `returns NUMBER` keeps working while learners are still getting used to Claro's capitalization. A declared return with no `RETURN`, or with a `RETURN` only inside an `IF`, gets a beginner-facing message explaining that the function may finish without returning the promised type:
```text
Function choose declares RETURNS NUMBER but does not return a NUMBER value on every path. Add RETURN to each branch or after the conditional.
```
The focused validation matrix covers modern and compatibility syntax, including a compatibility method that returns a class-declared field, method success and mismatch fixtures, unknown method return expressions, typed field returns, missing returns, and conditional-only returns. It also includes a positive nested `IF`/`ELSE` return example inside a method, so a complete nested method path is protected from regression. Full path-sensitive analysis proving that every `IF`/`ELSE` branch returns remains planned.
## Object method parameter checks ## Object method parameter checks
Method declarations also reject repeated parameter names before calls are checked. This protects both the modern `TEACH ... END` form and the compatibility `TAKES` / `LEARNED` form:
```claro
CLASS Player
TEACH greet name, name
SAY name
END
END
```
```text
Method Player.greet declares parameter name more than once. Give each parameter a different name.
```
Give every method parameter a different name. The focused validation matrix covers both method spellings.
Claro also checks simple object method arguments when the method body names a parameter with `CHECK TYPE`. This keeps the method syntax beginner-readable while giving a clearer error before the program runs: Claro also checks simple object method arguments when the method body names a parameter with `CHECK TYPE`. This keeps the method syntax beginner-readable while giving a clearer error before the program runs:
```claro ```claro
@@ -123,9 +710,33 @@ Output:
Type mismatch for method Player.add: parameter points needs NUMBER, but this argument looks like TEXT. Type mismatch for method Player.add: parameter points needs NUMBER, but this argument looks like TEXT.
``` ```
Both sides of this narrow method foundation are covered by validation: `tests/typecheck_method_good.claro` checks that `DO player.add 5` is accepted, and `tests/typecheck_method_bad.claro` checks the friendly wrong-type diagnostic. If the learner forgets a checked method argument, `claro typecheck` also names the missing method parameter and expected type:
If the method call comes before the object is created, the type checker now gives the learner the missing setup step: ```claro
DO player.add
```
Output:
```text
Method Player.add needs argument points as NUMBER, but this call does not provide it.
```
If the learner gives too many arguments to a simple checked method, `claro typecheck` now points to the extra argument instead of silently accepting it:
```claro
DO player.add 5, 6
```
Output:
```text
Method Player.add only accepts 1 argument, but this call gives 2. Remove the extra argument.
```
Both sides of this narrow method foundation are covered by validation: `tests/typecheck_method_good.claro` checks that `DO player.add 5` is accepted, `tests/typecheck_method_bad.claro` checks the friendly wrong-type diagnostic, `tests/typecheck_method_missing_arg_bad.claro` checks the missing checked-argument diagnostic, and `tests/typecheck_method_extra_arg_bad.claro` checks the extra-argument diagnostic. Multi-method class examples are covered too, including the extra-argument case where the checked method appears after another method in the same class. A compatibility `CALL second.add WITH 5, 6` through a two-step alias is also covered by `tests/typecheck_object_alias_method_call_extra_arg_bad.claro`, preserving the same actionable extra-argument message for older lessons.
If the method call comes before the object is created, the type checker now gives the learner the missing setup step. The modern `DO` form and the older compatibility `CALL ... WITH` form both get this guidance, even when the method name is also a typo:
```claro ```claro
CLASS Player CLASS Player
@@ -138,14 +749,38 @@ CLASS Player
END END
DO player.add 5 DO player.add 5
CALL player.add WITH 5
CALL player.fly WITH 5
``` ```
Output: Output:
```text ```text
Object player is not known yet. Create it with NEW ClassName player before calling player.add. Object player is not known yet. Create it with NEW ClassName player before calling player.add.
Object player is not known yet. Create it with NEW ClassName player before calling player.fly.
``` ```
If the object exists but the class does not declare the method, Claro now names the class and suggests where to add the missing `TEACH` block. This is validated for the modern `DO player.fly 5` form and the older compatibility `CALL player.fly WITH 5` form:
```claro
DO player.fly 5
CALL player.fly WITH 5
```
Output:
```text
Object Player has no method fly. Check the method name or add TEACH fly inside CLASS Player.
```
When a script declares classes, `NEW` also checks that the requested class exists. A typo such as `NEW Plaeyr player` receives a repair hint:
```text
Class Plaeyr is not known yet. Check the class name or declare CLASS Plaeyr before creating player.
```
For backward compatibility, a script with no `CLASS` declarations keeps the older permissive `NEW` behavior.
## Object field assignment checks ## Object field assignment checks
Claro also has a narrow static diagnostic for direct object-field assignments. If a class declares a typed field and a script creates a simple object with `NEW Class name`, `claro typecheck` remembers the field type: Claro also has a narrow static diagnostic for direct object-field assignments. If a class declares a typed field and a script creates a simple object with `NEW Class name`, `claro typecheck` remembers the field type:
@@ -171,6 +806,28 @@ Output:
Type mismatch for field player.score: expected NUMBER, but this value looks like TEXT. Type mismatch for field player.score: expected NUMBER, but this value looks like TEXT.
``` ```
Simple expressions are checked too. Text joined with a number has a `TEXT` result, so this mistake is caught before running the program:
```claro
SET player.name "Ada"
SET player.score player.name + 1
```
```text
Type mismatch for field player.score: expected NUMBER, but this value looks like TEXT.
```
The reverse mismatch is checked as well. A numeric expression cannot be stored in a `TEXT` field:
```claro
SET player.score 10
SET player.name player.score + 1
```
```text
Type mismatch for field player.name: expected TEXT, but this value looks like NUMBER.
```
If a learner assigns to a field the class did not declare, `claro typecheck` now names the object class and suggests the matching `HAS` line: If a learner assigns to a field the class did not declare, `claro typecheck` now names the object class and suggests the matching `HAS` line:
```claro ```claro
@@ -263,8 +920,34 @@ Object player is not known yet. Create it with NEW ClassName player before setti
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, `tests/typecheck_object_field_unknown_object_bad.claro` checks that `SET player.score 10` before `NEW Player player` reports the missing-object assignment diagnostic, `tests/typecheck_object_field_check_type_unknown_object_bad.claro` checks the matching missing-object `CHECK TYPE` diagnostic, and the remaining object-field fixtures cover known-field mismatches, unknown NUMBER/TEXT/YESNO fields, and unknown-field assignments whose value type is not inferable yet. 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, `tests/typecheck_object_field_unknown_object_bad.claro` checks that `SET player.score 10` before `NEW Player player` reports the missing-object assignment diagnostic, `tests/typecheck_object_field_check_type_unknown_object_bad.claro` checks the matching missing-object `CHECK TYPE` diagnostic, and the remaining object-field fixtures cover known-field mismatches, unknown NUMBER/TEXT/YESNO fields, and unknown-field assignments whose value type is not inferable yet.
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. This slice is intentionally small: it covers direct `NEW Class object` plus `SET object.field value` cases in one file. Field declarations are collected even when a learner writes a simple method before a later `HAS` field, so the type checker can still report the field's declared type. Broader object flows, aliases, method return checks, and richer object signatures remain future work.
Simple functions also get an arity check before running. If a learner defines `TEACH greet name` and then writes `DO greet` without the `name` argument, `claro typecheck` reports:
```text
Function greet needs 1 argument, but this call gives 0. Add the missing argument.
```
The older compatibility spelling gets the same beginner-facing result when `WITH` is left empty:
```claro
CALL greet WITH
```
Output:
```text
Function greet needs 1 argument, but this call gives 0. Add the missing argument.
```
The same method-aware diagnostic is used when a method directly assigns the wrong value to a class field. For example, `SET name 123` inside `Player.rename` reports `Type mismatch for field name in Player.rename: expected TEXT, but this value looks like NUMBER.` The operator-specific form also remains available: `SET score score + name` inside `Player.add RETURNS NUMBER` reports `Type mismatch for field score in Player.add: addition needs NUMBER values, but name looks like TEXT.` YESNO fields use the same clear method context: assigning text to `HAS ready YESNO` inside `Player.toggle` reports `Type mismatch for field ready in Player.toggle: expected YESNO, but this value looks like TEXT.` Both modern `DO` and compatibility `CALL ... WITH` method forms are covered by the focused validation matrix. These focused checks cover typed method bodies; broader control-flow and object-flow analysis remains planned.
## Status ## Status
This is currently a static checker feature. It improves `claro typecheck` and validation confidence for `DO` and compatibility `CALL ... WITH` function calls, simple `DO object.method ...` calls where the object was created with `NEW Class name`, and direct assignments to known object fields. Runtime enforcement for every container mutation and richer function/object signatures can be added later after the syntax is classroom-tested. This is currently a static checker feature. It improves `claro typecheck` and validation confidence for `DO` and compatibility `CALL ... WITH` function calls, simple `DO object.method ...` calls where the object was created with `NEW Class name`, and direct assignments to known object fields. Runtime enforcement for every container mutation and richer function/object signatures can be added later after the syntax is classroom-tested.
Method-body field assignments are covered in both modern and compatibility syntax, including a valid YESNO assignment through `TEACH toggle TAKES value` and `CALL player.toggle WITH YES`. Method-body `CHECK TYPE` metadata has the same balanced coverage: a modern `DO player.toggle YES` example and the compatibility `CALL` example both verify a declared YESNO field. The focused release validator keeps these positive examples beside the wrong-type diagnostics.
A bare field typo inside a method's `CHECK TYPE` is also checked now. For example, `CHECK TYPE level IS NUMBER` in `Player.train` reports `Object Player has no field level. Check the field name or add HAS level NUMBER to the class.` The older `TAKES` / `LEARNED` method spelling receives the same diagnostic. This keeps method metadata checks consistent with direct method-field assignments and uses the expected type to make the repair actionable.
Inline method-field annotations are checked for known type names too. For example, `SET score AS BANANA TO 10` inside `Player.set_score` reports `Field score in Player.set_score needs a known type such as NUMBER, TEXT, or YESNO, but BANANA is not a Claro type. Use NUMBER for score.`
+1 -1
View File
@@ -58,7 +58,7 @@ claro package doctor
claro package lock claro package lock
``` ```
The v1.18.26 package command is a safer local project-file helper. It creates `claro.project`, `claro.lock`, and local folders under `packages/`. It is not yet an online package registry. The v1.18.26 package command is a safer local project-file helper. It creates `claro.project`, `claro.lock`, and local folders under `packages/`. Package names may appear only once in `claro.project`; `claro package doctor` reports duplicate entries so the lockfile stays unambiguous. It also requires the project manifest to have exactly one non-empty `name:` field. It is not yet an online package registry.
## IDE metadata ## IDE metadata
+56 -6
View File
@@ -51,15 +51,46 @@ Status: **Foundation present**
Ready now: Ready now:
- typed variables such as `SET score NUMBER 10` - typed variables such as `SET score NUMBER 10`
- `TYPE OF` and `CHECK TYPE` - `TYPE OF` and `CHECK TYPE`
- typed list/map checks through `claro typecheck` - `CHECK TYPE` gives a direct repair hint when the learner forgets the `IS` keyword, for example `CHECK TYPE score` reports `CHECK TYPE needs IS. Try: CHECK TYPE score IS NUMBER.`
- 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, catch mismatched `DO`, `CALL ... WITH`, and `DO object.method ...` arguments, and explain when a `DO object.method ...` call happens before the object is created with `NEW` - `CHECK TYPE` gives a direct repair hint when `IS` has no expected type, for example `CHECK TYPE score IS` reports `CHECK TYPE score needs a type after IS. Try: CHECK TYPE score IS NUMBER.`
- a narrow object-field assignment/check-type check for simple `NEW Class object` plus direct `SET object.field value` and `CHECK TYPE object.field IS TYPE` cases when the class declares `HAS field TYPE`; validation now covers correct NUMBER, TEXT, and YESNO direct assignments, direct `CHECK TYPE` metadata acceptance for NUMBER/TEXT/YESNO fields, negative NUMBER/TEXT/YESNO field `CHECK TYPE` metadata mismatches, NUMBER/TEXT/YESNO-expectation unknown-field `CHECK TYPE` diagnostics, missing-object field assignment and `CHECK TYPE` diagnostics, NUMBER/TEXT/YESNO wrong-type diagnostics, NUMBER/TEXT/YESNO-valued unknown-field diagnostics for direct assignments to undeclared fields, plus a plain beginner-facing unknown-field diagnostic when the assigned expression type is not inferable yet - `CHECK TYPE` explains when the learner leaves out the expression as well, for example bare `CHECK TYPE` reports `CHECK TYPE needs an expression, IS, and a type. Try: CHECK TYPE score IS NUMBER.`
- typed function and method returns reject simple extra tokens after a return value with a direct repair hint, such as `RETURN amount extra` reporting `Keep only one expression after RETURN.` This is covered for modern functions and both modern and compatibility object methods.
- `CHECK TYPE` explains when `IS` is present but the expression is missing, for example `CHECK TYPE IS NUMBER` reports `CHECK TYPE needs an expression before IS. Try: CHECK TYPE score IS NUMBER.`
- `CHECK TYPE` rejects extra words after a valid expected type with a direct repair hint, so `CHECK TYPE score IS NUMBER TEXT` explains that only one type belongs in the check
- `CHECK TYPE` rejects unknown expected type names with a beginner-facing list of supported types
- typed function return diagnostics also identify an unknown return expression in compatibility `TAKES` / `LEARNED` functions, matching the modern function and object-method guidance
- `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` 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
- compatibility `TAKES` / `LEARNED` functions also have focused positive numeric-addition, subtraction, division, and multiplication return fixtures, keeping arithmetic return coverage aligned with modern functions and compatibility methods.
- compatibility `TAKES` / `LEARNED` functions have positive complete-branch return coverage beside the incomplete-branch diagnostic, so older conditional examples are checked for both accepted and rejected paths.
- 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, catch mismatched `DO`, `CALL ... WITH`, `DO object.method ...`, and compatibility `CALL ... WITH` arguments, including checked methods that appear after another method in the same class, report missing checked function and method arguments, report missing unchecked arguments for simple functions and simple object methods in both modern `DO` and compatibility `CALL ... WITH` forms, treat empty compatibility calls such as `CALL greet WITH` and `CALL player.rename WITH` as missing-argument mistakes, catch extra arguments to simple functions and checked methods even when the checked method appears after another method in the same class, catch modern `DO` and compatibility `CALL ... WITH` calls to undeclared simple functions, explain when `DO object.method ...` or compatibility `CALL ...` happens before the object is created with `NEW` even if the method name is also wrong, and catch modern plus compatibility calls to undeclared object methods with a class-specific `TEACH` hint
- simple function and object-method return checks with `TEACH name ... RETURNS TYPE` now include a compatibility `TAKES` / `LEARNED` function whose conditional returns are incomplete, preserving the same every-path diagnostic as modern functions.
- function and method declarations now reject repeated parameter names with a direct repair hint before calls are checked, including modern and compatibility `TAKES` / `LEARNED` functions and methods; object methods with the same name are also rejected within a class with a rename hint in both modern and compatibility method syntax
- top-level function declarations now reject repeated names with a direct repair hint, so two `TEACH greet` blocks cannot silently compete for one callable function; a missing function name after `TEACH` gets a direct beginner-facing repair hint, and a missing method name inside `CLASS` names the class and gives a method example
- class declarations now reject a missing class name after `CLASS` with a direct beginner-facing repair hint
- class declarations now reject repeated field names within the same class with a direct repair hint before field types are used, so two `HAS score ...` lines cannot silently choose conflicting metadata; different classes may independently use the same field name
- class field declarations now reject missing names such as bare `HAS`, missing types such as `HAS score`, unknown types such as `HAS score BANANA`, and extra tokens such as `HAS score NUMBER TEXT` with the field name, class name, supported type examples, and a repair hint before object-field checks use that metadata
- class declarations now reject repeated class names with a direct repair hint, so two `CLASS Player` blocks cannot silently compete for the same name; extra words after a class name also get a direct repair hint instead of becoming part of the class identity
- object creation now rejects repeated object names with a direct repair hint, so two `NEW Player player` statements cannot silently replace one another during type checking; when a script declares at least one class, a misspelled `NEW` class name gets a direct declaration hint without changing the older permissive no-class form; a missing class name or object name gets a direct example repair; extra words after the object name get a direct repair hint instead of being silently ignored
- a narrow object-field assignment/check-type check for simple `NEW Class object` plus direct `SET object.field value` and `CHECK TYPE object.field IS TYPE` cases when the class declares `HAS field TYPE`; validation now covers correct NUMBER, TEXT, and YESNO direct assignments, explicitly typed field assignments, explicitly typed method-body assignments to undeclared fields with a `HAS field TYPE` repair hint in modern and compatibility method syntax, dedicated positive NUMBER/TEXT/YESNO `CHECK TYPE` metadata fixtures, simple and chained object aliases for both field assignments and `CHECK TYPE` metadata (including a chained TEXT-field check), aliased object-method calls including chained aliases in modern `DO` and compatibility `CALL ... WITH` forms (with a dedicated positive modern `DO` chained-alias fixture), field-to-field, compound arithmetic field expressions, and arithmetic/text expression result types, negative NUMBER/TEXT/YESNO field `CHECK TYPE` metadata mismatches, NUMBER/TEXT/YESNO-expectation unknown-field `CHECK TYPE` diagnostics, missing-object field assignment and `CHECK TYPE` diagnostics, NUMBER/TEXT/YESNO wrong-type diagnostics, field collection when a `HAS` field appears after a simple method, NUMBER/TEXT/YESNO-valued unknown-field diagnostics for direct assignments to undeclared fields including explicitly typed assignments, numeric and text results from simple arithmetic/text expressions in object-field assignments, plus method-body field assignment and `CHECK TYPE` diagnostics for NUMBER, TEXT, and YESNO fields in modern and compatibility syntax, including compatibility YESNO `CHECK TYPE` metadata coverage, direct method assignments to undeclared fields now produce a beginner-facing missing-field diagnostic when the assigned expression has a known type, and a plain beginner-facing unknown-field diagnostic when the assigned expression is not inferable yet in both modern and compatibility method syntax; method-body `CHECK TYPE` now reports an undeclared bare field with the expected type as a repair hint in both modern and compatibility method syntax, including compatibility `TAKES` / ...; explicitly typed assignments to declared method fields now validate the class-declared field type instead of trusting only the inline type annotation, so a wrong value such as `SET score TEXT "oops"` reports the method and field in the diagnostic
Still needed: Still needed:
- richer typed function signatures and return values - Keep the focused typecheck validator's fixture list complete as new positive and negative examples are added. `claro validate` now executes the complete focused fixture matrix as well, so release validation cannot silently omit a listed typecheck example.
- The expression checker now carries a known TEXT operand through all arithmetic operators so object-field and typed-function-return diagnostics do not hide addition, subtraction, multiplication, or division mistakes; focused numeric-subtraction, numeric-division, and numeric-multiplication positives plus text-operand addition, subtraction, multiplication, and division negatives protect this behavior. Typed-function return diagnostics now have focused subtraction and division positives alongside multiplication coverage. Text concatenation into a TEXT field has focused positive fixtures for both operand orders, including concatenation of two TEXT object fields. Each numeric operator names the text operand and explains that it needs NUMBER values.
- Method return validation now has focused positive subtraction and division fixtures alongside the existing arithmetic return coverage, including compatibility `TAKES` / `LEARNED` subtraction and division cases, so checked NUMBER method parameters and numeric subtraction or division remain accepted by the release validator in both method spellings.
- Modern and compatibility `TAKES` / `LEARNED` methods have positive NUMBER, TEXT, and YESNO field-assignment coverage, and modern plus compatibility method-body `CHECK TYPE` metadata now have positive YESNO coverage beside the wrong-value diagnostics.
- Modern method-body TEXT concatenation has positive coverage in both operand orders, such as `SET first first + "!"` and `SET last "Dr. " + last`.
- Compatibility method-body TEXT concatenation has matching positive coverage in both operand orders, so `TAKES` / `LEARNED` methods keep the same beginner-safe field update behavior.
- richer typed function signatures and return values beyond the focused simple function/method `RETURNS TYPE` check
- type checking through branches and loops - type checking through branches and loops
- richer object field type checking beyond simple direct assignments - richer object field type checking beyond simple direct assignments
- typed imports/modules - typed imports/modules
- inline method-field annotations must agree with the class `HAS` declaration in both modern `TEACH` / `END` and compatibility `TAKES` / `LEARNED` methods; conflicting annotations now get a repair-oriented diagnostic even when the value's inferred type is otherwise correct.
- inline method-field annotations also reject unknown names such as `BANANA`, naming the field and method and suggesting the class-declared type.
- compatibility `TEACH ... TAKES ...` / `LEARNED` methods have matching validation for unknown inline field annotations, so older lessons receive the same repair guidance.
Good starting docs: Good starting docs:
- `ADVANCED_STATIC_TYPING.md` - `ADVANCED_STATIC_TYPING.md`
@@ -96,7 +127,25 @@ Ready now:
- `claro package init` - `claro package init`
- `claro package add/list/remove/doctor/lock` - `claro package add/list/remove/doctor/lock`
- local project files such as `claro.project`, `claro.lock`, and `packages/` - local project files such as `claro.project`, `claro.lock`, and `packages/`
- package-name safety checks - starter projects from `claro new` now use the same manifest-version and lock-version headers as `claro package init`
- the default `make` target builds both `claro` and `claro.exe`, so cross-platform release validators exercise freshly built executables
- project-name safety checks for `claro new`, so unsafe names such as `../bad` are rejected before Claro creates folders
- package-name safety checks when adding packages, including the 64-character package-name limit, when `claro package doctor` audits an existing `claro.project`, when `claro package lock` writes lockfile data, when `claro package list` shows existing packages, when `claro package init` sees unsafe names already present in `claro.project`, when `claro package add` sees unsafe names already present in `claro.project`, when `claro package remove` refreshes the lockfile after an edit, when learners need to remove an unsafe package entry that is already present, when `claro package doctor` verifies lockfile checksums for listed packages, and when `claro package doctor` rejects lockfile package entries that are not listed in `claro.project`
- `claro package doctor` rejects a listed package manifest whose `name:` does not match the package name in `claro.project`
- `claro package doctor` compares the complete manifest `name:` value, so a prefix such as `math-tools-extra` cannot be accepted for package `math-tools`
- `claro package doctor` requires exactly one complete supported package `manifest-version: 1` field; missing, blank, unsupported, or duplicate format fields get a `BAD package manifest version` diagnostic with the file path and a repair hint, rather than calling an existing file missing
- `claro package doctor` compares the complete manifest `checksum:` value, so a valid checksum followed by extra text is rejected
- `claro package doctor` requires the complete supported `manifest-version: 1` value in `claro.project`, so a prefix such as `manifest-version: 10` is rejected
- `claro package doctor` requires the complete supported `version: 1` value in each local package manifest, so a prefix such as `version: 10` is rejected
- `claro package doctor` requires exactly one current `version: v1.18.26` line in `claro.lock`, so stale, missing, blank, or duplicate lockfile release versions are rejected
- `claro package doctor` requires the complete supported `source: local` value in each local package manifest, so a prefix such as `source: local-extra` is rejected
- package project entries must be unique; `claro package doctor`, `list`, `add`, `init`, and `lock` reject duplicate names instead of generating ambiguous package or lockfile data
- lockfile package entries must also be unique; `claro package doctor` reports duplicate lock entries instead of accepting ambiguous package/checksum data
- package manifest `name:` entries must also be unique; `claro package doctor` reports `BAD package manifest name` instead of accepting ambiguous package identity data
- package manifest `checksum:` entries must also be unique; `claro package doctor` reports `BAD package checksum` instead of accepting ambiguous integrity data
- package manifest `version:` entries must also be unique and must contain exactly `1`; `claro package doctor` reports `BAD package version` instead of accepting ambiguous package metadata
- project manifests must contain exactly one `manifest-version: 1` field; duplicate or prefix-matching values are rejected with `BAD project manifest version: expected 1`
- project manifests must contain exactly one non-empty `name:` field; `claro package doctor` reports `BAD project manifest name: expected a non-empty name` when the project identity is missing or blank
Still needed: Still needed:
- install from local path - install from local path
@@ -154,8 +203,9 @@ Status: **Foundation present**
Ready now: Ready now:
- `claro ide` - `claro ide`
- metadata JSON - metadata JSON
- completion list - completion list, including the current typed-language keywords `RETURNS`, `CHECK`, and `TYPE`
- diagnostics helper - diagnostics helper
- Forgejo/Gitea CI coverage for the current release validation gates (`claro validate`, typecheck diagnostics validation, version convention validation, package security validation, compiler warning validation, and the CI workflow coverage check); the compiler warning validator rebuilds `src/claro.c` and rejects path-truncation warnings, while the workflow validator verifies these commands, including its own command, occur in executable `run` steps rather than comments
Still needed: Still needed:
- syntax highlighting package - syntax highlighting package
+60 -7
View File
@@ -31,21 +31,74 @@ See `CURRENT_STATUS.md` for the detailed feature matrix.
1. Keep beginner-facing docs current and separate from historical release notes. 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. 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, one wrong-type diagnostic, and missing-object guidance when `DO player.method ...` appears before `NEW`; object-field validation covers correct NUMBER, TEXT, and YESNO direct `SET object.field value` assignments, direct `CHECK TYPE` metadata acceptance for NUMBER/TEXT/YESNO fields, negative NUMBER/TEXT/YESNO metadata mismatches, NUMBER/TEXT/YESNO-expectation unknown-field `CHECK TYPE` diagnostics, missing-object field assignment and `CHECK TYPE` diagnostics, NUMBER/TEXT/YESNO wrong-type direct assignments, simple NUMBER/TEXT/YESNO-valued unknown-field diagnostics after `NEW Class object`, and a beginner-facing fallback when the unknown field's assigned expression type is not inferable yet. 3. Expand validation around typecheck diagnostics and package/networking safety. Current Forgejo/Gitea CI runs the documented release gates (`claro validate`, typecheck diagnostics validation, version convention validation, package security validation, compiler warning validation, and CI workflow coverage validation). The compiler warning validator rebuilds `src/claro.c` and blocks path-truncation warnings; the workflow coverage validator checks executable `run` steps rather than comments and requires its own command. Current package safety validation covers safe project creation, rejecting unsafe project names during `claro new`, safe manifest/lockfile creation, rejecting unsafe package names during `package add`, detecting unsafe package names already present in `claro.project` during `package doctor`, refusing to write lockfile data for unsafe package names during `package lock`, making `package list` fail instead of displaying unsafe package entries as normal package names, making `package init` fail instead of reporting the project ready when unsafe package names are already present, making `package add` fail before changing files when unsafe package names are already present, making `package remove` fail instead of reporting success when unsafe package names remain during lockfile refresh, allowing `package remove` to remove an exact unsafe package entry so learners can repair a bad `claro.project`, making `package doctor` reject stale lockfile checksums for listed packages, and making `package doctor` reject lockfile package entries that are not listed in `claro.project`. Current function validation covers correct checked calls, wrong-type arguments, missing checked-argument diagnostics, missing unchecked-argument diagnostics for simple functions in both modern `DO greet` and empty compatibility `CALL greet WITH` forms, extra-argument diagnostics, and beginner-facing unknown-function diagnostics for mistyped modern `DO` and compatibility `CALL ... WITH` calls; current object-method parameter validation covers correct modern `DO object.method ...` and compatibility `CALL object.method WITH ...` checked calls, wrong-type diagnostics for both call forms, checked methods after another method in the same class, missing and extra checked-argument diagnostics including the extra-argument case for a checked method after another method in the same class, missing unchecked-argument diagnostics for simple object methods, missing-object guidance when `DO player.method ...` or compatibility `CALL object.method WITH ...` appears before `NEW` even if the method name is also wrong, and class-specific unknown-method diagnostics for both modern and compatibility calls when a learner calls a method the class does not declare; current object-field validation covers direct NUMBER/TEXT/YESNO field-assignment positives, direct object-field `CHECK TYPE` metadata positives for NUMBER/TEXT/YESNO fields, negative NUMBER/TEXT/YESNO field metadata mismatches, NUMBER/TEXT/YESNO-expectation unknown-field `CHECK TYPE` diagnostics, direct wrong-type field assignment diagnostics, field collection when a `HAS` field appears after a simple method, direct unknown-field diagnostics for NUMBER/TEXT/YESNO values, a beginner-facing fallback for unknown fields assigned from expressions whose type is not inferable yet, and missing-object diagnostics for both `SET object.field value` and `CHECK TYPE object.field IS TYPE` before `NEW`.
4. Add small examples for each foundation feature before adding bigger syntax. 3a. Keep package diagnostics actionable: invalid package manifest format fields now name the file and explain how to repair it, separately from an absent manifest. Keep package validation honest by checking that the project manifest has one non-empty project name, that the project and each listed package manifest declare the exact supported manifest version, package version, local source, and expected package name, and that lockfiles declare exactly one current release version.
3b. Keep package security validation in Forgejo/Gitea CI so unsafe names, exact manifest-version/name/version/checksum mismatches, missing manifests, duplicate project manifest versions and packages, duplicate lock packages, duplicate package manifest names, versions, and checksums, and lockfile errors remain release blockers.
4. Add small examples for each foundation feature before adding bigger syntax. The object-field foundation now includes positive and negative validation for field expressions such as `SET player.score player.name`, `SET player.score player.score + 1`, `SET player.name player.score + 1`, explicitly typed field assignments, explicit typed assignments to undeclared fields, simple and chained aliases such as `SET alias player`, `SET backup alias`, followed by `SET backup.score ...` or `CHECK TYPE backup.score IS ...`, chained aliases in object-method calls through both modern `DO` and compatibility `CALL ... WITH` forms (including a dedicated positive modern `DO` fixture), and arithmetic/text expression mismatches; typed containers also accept a map with nested type metadata when it is added to a `LIST OF MAP`; broader alias/control-flow checking remains planned.
5. Keep the focused typecheck validator complete: the method-body field diagnostic fixtures are now exercised by `claro validate` alongside the standalone diagnostic validator; continue wiring each new `typecheck_*.claro` fixture into both gates. Modern and compatibility unknown-field expression diagnostics now have matching focused coverage, and explicitly typed unknown method-field assignments have matching modern and compatibility fixtures with the expected `HAS field TYPE` repair hint.
-6. Continue narrowing expression diagnostics: known TEXT operands now remain visible through arithmetic, with focused numeric-subtraction, numeric-division, and numeric-multiplication positives plus text-operand addition, subtraction, multiplication, and division coverage. Typed function returns now include positive subtraction and division examples alongside multiplication, including compatibility `TAKES` / `LEARNED` numeric-addition, subtraction, division, and multiplication return fixtures. Text concatenation into TEXT fields is covered in both operand orders, including field-to-field concatenation. Each numeric operator names the text operand and explains that it needs NUMBER values. Compatibility method return diagnostics now cover addition, subtraction, division, and multiplication. `CHECK TYPE` also rejects misspelled expected type names.
- Keep typed method return examples balanced: numeric addition, subtraction, division, and multiplication now have dedicated positive compatibility `TAKES` / `LEARNED` method fixtures in the focused validator, alongside compatibility addition, subtraction, and division mismatch coverage and the existing method return mismatch diagnostics.
- Keep method field examples balanced across syntax generations: modern and compatibility `TAKES` / `LEARNED` NUMBER, TEXT, and YESNO assignments now have positive fixtures beside the modern and compatibility mismatch fixtures, and modern plus compatibility YESNO method-field metadata now have dedicated positive fixtures beside the negative fixture.
- Keep IDE metadata aligned with the current beginner syntax: typed-language keywords such as `RETURNS`, `CHECK`, and `TYPE` are now included in the metadata used by editor helpers.
- Keep compatibility-call coverage aligned with modern calls: empty `CALL object.method WITH` forms now have a focused missing-argument diagnostic fixture alongside the modern `DO object.method` case.
Keep declared return types honest: `claro typecheck` now reports friendly diagnostics for unknown declared return types, missing return types, mismatched, not-yet-inferable, and empty return expressions (including compatibility `TAKES` / `LEARNED` methods), declarations with no `RETURN` in modern and compatibility function forms, and incomplete conditional branches, when a simple function or object method declares `RETURNS TYPE`; missing-type coverage includes modern functions and both modern and compatibility methods, with a compatibility-function fixture as well. Incomplete conditional-return coverage now also includes the compatibility `TAKES` / `LEARNED` function spelling, so older lessons receive the same every-path diagnostic. The declaration keyword is case-insensitive like other Claro keywords, with positive coverage in modern and compatibility function forms, including lowercase compatibility declarations and lowercase compatibility method declarations, plus a lowercase compatibility-method mismatch fixture. Complete `IF`/`ELSE` return branches, including nested complete conditionals in functions and methods, are accepted, and modern and compatibility function syntax plus compatibility method syntax are covered by focused fixtures. `CHECK TYPE` parameter metadata also informs arithmetic return-expression checking, including object methods; positive numeric multiplication return coverage now sits beside the mismatch fixtures, including a dedicated compatibility-method multiplication success fixture; typed methods can also return class-declared fields by simple name, with positive and mismatch fixtures in both modern and compatibility method syntax, and unknown method return expressions now have dedicated modern and compatibility diagnostic fixtures, and NUMBER return expressions with known TEXT arithmetic operands identify the operation and offending operand, including focused addition, subtraction, multiplication, and division coverage for functions and methods. Compatibility method subtraction diagnostics are also covered alongside the existing addition diagnostic. Full path-sensitive analysis across nested conditionals and loops remains planned.
## Complete-platform milestones 7. Keep method-body field diagnostics learner-facing: typed methods now name the class method when a simple class field receives a known mismatch in `CHECK TYPE` or assignment, or a known TEXT operand in a NUMBER expression, with matching text and numeric coverage in modern and compatibility method syntax; direct assignments to undeclared method fields now report the missing field when the value type is known, and bare `CHECK TYPE missing IS TYPE` statements inside methods now use the expected type in the repair hint in both modern and compatibility method syntax; broader control-flow and object-flow analysis remains planned.
8: Keep method-body coverage balanced across beginner field types and syntax generations: YESNO field assignment mismatches are now validated for both modern `DO` and compatibility `CALL ... WITH` method syntax, method-body `CHECK TYPE` metadata mismatches now have matching compatibility `TAKES` / `LEARNED` coverage alongside the modern form, compatibility YESNO field metadata has dedicated positive and negative fixtures, and compatibility method assignments to undeclared fields have the same focused missing-field diagnostic as modern methods, including a beginner-facing fallback when the assigned expression is not inferable yet.
8a. Keep method-body text expressions balanced: modern TEXT field concatenation is covered when the field is on either side of `+`, so both common beginner word-order patterns remain accepted.
8b. Keep compatibility method-body text expressions aligned: `TAKES` / `LEARNED` methods now have positive TEXT concatenation coverage in both operand orders beside the modern `TEACH` / `END` examples.
8c. Keep explicit method-field annotations aligned with class declarations: `SET score TEXT "oops"` inside a method with `HAS score NUMBER` now reports the declared field mismatch instead of accepting the inline annotation; broader annotation consistency remains planned.
8d. Keep inline method-field annotations consistent with `HAS` declarations: `claro typecheck` now rejects a conflicting annotation even when the assigned value itself has the class-declared type, and explains which type to use.
8e. Keep inline method-field annotation coverage aligned across syntax generations: compatibility `TAKES` / `LEARNED` methods now have matching positive and negative fixtures, so older lessons retain the same class-declared-type guidance.
8f. Keep inline method-field annotations learner-facing: an unknown annotation such as `BANANA` now names the field and method and suggests the `HAS` type instead of silently treating the annotation as an expression.
8g. Keep unknown inline method-field annotation diagnostics aligned across syntax generations: compatibility `TAKES` / `LEARNED` methods now have matching focused coverage for misspelled annotations.
8h. Keep function and method declarations unambiguous: `claro typecheck` now reports repeated parameter names with a repair hint, before duplicate names can make argument diagnostics confusing, including modern and compatibility `TAKES` / `LEARNED` functions and methods. Duplicate object method names within one class now get the same declaration-time protection and a rename hint, with focused coverage for both modern and compatibility method syntax. Broader signature validation remains planned.
8h.1. Keep top-level function declarations unambiguous: duplicate `TEACH greet` blocks now get a declaration-time diagnostic with a rename hint, preventing two functions from competing for one name. Broader signature validation remains planned.
8h.2. Keep function declarations understandable: a bare `TEACH` now gets a direct diagnostic explaining that a function name is required, with a small example repair. Broader signature validation remains planned.
8h.3. Keep method declarations understandable: a bare `TEACH` inside a class now names the class and explains how to add a method name, instead of using the less-specific top-level function diagnostic.
8i. Keep class declarations unambiguous: duplicate `HAS` field names within one class now get a declaration-time diagnostic with a repair hint, preventing conflicting field types from being silently accepted, while same-named fields in different classes remain valid. Broader object declaration validation remains planned.
8j. Keep class names unambiguous: duplicate `CLASS Player` declarations now get a declaration-time diagnostic with a rename hint, preventing two class definitions from competing for one name. Extra words after a class name also get a declaration-time repair hint, so a typo such as `CLASS Player Extra` cannot silently create a surprising class identity.
8k. Keep object names unambiguous: repeated `NEW Player player` statements now get a declaration-time diagnostic with a rename hint, preventing one object type environment from silently replacing another.
8l. Keep object creation understandable: when classes are declared in a script, an unknown `NEW` class name now gets a direct class-name diagnostic and repair hint; the older permissive `NEW` behavior remains when no class declarations are present.
8m. Keep class field metadata understandable: a missing or unknown type in a `HAS field TYPE` declaration, or extra text after a valid type, now gets a class-and-field diagnostic with supported type examples or a direct repair hint before object-field checks use that metadata.
8m.1. Keep class field declarations understandable: a bare `HAS` now gets a direct diagnostic explaining that both a field name and type are required, with a small `HAS score NUMBER` repair example.
8n. Keep object creation unambiguous: extra words after `NEW ClassName object` now get a direct repair hint, so a malformed object declaration cannot silently discard part of the learner's input.
8o. Keep class declarations understandable: a bare `CLASS` now gets a direct diagnostic explaining that a class name is required, with a small example repair.
8p. Keep object declarations understandable: a `NEW` statement with a class but no object name now gets a direct diagnostic with a complete `NEW Player player` repair example; a bare `NEW` now separately explains that both a class and object name are required.
8q. Keep `CHECK TYPE` syntax understandable: a missing `IS` now gets a direct repair hint with a complete `CHECK TYPE score IS NUMBER` example.
8q.1. Keep `CHECK TYPE` declarations understandable: `CHECK TYPE score IS` now gets a direct repair hint naming the missing expected type and showing a complete example.
8q.2. Keep `CHECK TYPE` declarations unambiguous: extra words after a valid expected type now get a direct repair hint instead of being reported as an unknown type.
8q.3. Keep `CHECK TYPE` declarations complete: a bare `CHECK TYPE` now explains that the expression, `IS`, and expected type are all required, with a complete repair example.
8q.4. Keep `CHECK TYPE` declarations ordered: `CHECK TYPE IS NUMBER` now explains that an expression belongs before `IS`, with a complete repair example.
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.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`.
8q.9. Keep missing return-type diagnostics aligned across functions and methods: modern and compatibility methods now name the complete `Class.method` identity when `RETURNS` has no type, with focused fixtures in the typecheck and release validation matrices.
8q.10. Keep return statements beginner-readable: typed returns now identify simple extra tokens after a value and explain that `RETURN` accepts one expression, with focused release validation coverage.
8q.11. Keep extra-token return diagnostics aligned across syntax generations: modern and compatibility functions and object methods now have focused fixtures for `RETURN value extra`, so errors keep the function or class-and-method name and the same repair hint.
8q.12. Keep empty typed-return diagnostics aligned across syntax generations: modern and compatibility functions and object methods now have focused fixtures for bare `RETURN`, so each form explains that the declared type needs an expression.
8q.13. Keep unknown typed-return diagnostics aligned across syntax generations: compatibility `TAKES` / `LEARNED` functions now have a focused fixture for an uninferable return expression, matching modern functions and methods.
### 1. Strong static types ### 1. Strong static types
Goal: make larger beginner programs safer without making first scripts harder. Goal: make larger beginner programs safer without making first scripts harder.
Needed next: Needed next:
- richer typed function signatures - richer typed function signatures beyond the focused simple `RETURNS TYPE` check
- typed function returns - typed function returns beyond the focused simple function/method `RETURNS TYPE` check
- type checking across branches and loops - type checking across branches and loops
- typed imports/modules - typed imports/modules
- broader object field checking and method return typing - broader object field checking and richer method return typing
- clearer error messages for type mismatches - clearer error messages for type mismatches
### 2. Objects and classes polish ### 2. Objects and classes polish
@@ -54,7 +107,7 @@ Goal: keep object-oriented examples readable enough for beginners.
Needed next: Needed next:
- constructor-style defaults or beginner-friendly initialization helpers - constructor-style defaults or beginner-friendly initialization helpers
- method return checks - richer method return checks beyond the focused simple `RETURNS TYPE` check
- object printing/debugging helpers - object printing/debugging helpers
- better examples that avoid abstract toy OOP - better examples that avoid abstract toy OOP
+3
View File
@@ -24,6 +24,7 @@ Validate the current v1.18.26 package after building:
./claro validate ./claro validate
python tools/validate_typecheck_diagnostics.py python tools/validate_typecheck_diagnostics.py
python tools/validate_version_convention.py python tools/validate_version_convention.py
python tools/validate_ci_workflow.py
``` ```
Useful focused validation scripts: Useful focused validation scripts:
@@ -39,6 +40,8 @@ python tools/validate_lsp_helper.py
python tools/validate_package_security.py python tools/validate_package_security.py
``` ```
The Forgejo/Gitea CI workflow is expected to run the current release gates above, not only the older smoke tests. This includes `tools/validate_compiler_warnings.py`, which rebuilds the C source as an object file and rejects the known path-truncation warning class. `tools/validate_ci_workflow.py` checks that coverage so CI does not drift away from the documented package validation path.
Older `validate_rc*.py` scripts are kept for historical release notes. They are not the recommended current package validation path. Older `validate_rc*.py` scripts are kept for historical release notes. They are not the recommended current package validation path.
On Windows, after `build.bat` or `build.ps1`, run the same Python commands from the project root. On Windows, after `build.bat` or `build.ps1`, run the same Python commands from the project root.
+32 -2
View File
@@ -63,9 +63,35 @@ source: local
checksum: 1234abcd checksum: 1234abcd
``` ```
`claro.lock` records the release version, lock format, packages, and checksums so future registry work has a stable safety foundation. `claro.lock` records the release version, lock format, packages, and checksums so future registry work has a stable safety foundation. `claro package doctor` checks those lockfile checksums for listed packages and reports `BAD lock checksum: name` if the lockfile is stale or edited incorrectly. It rejects duplicate `package:` entries with `DUPLICATE lock package: name`, so one package cannot have ambiguous lock data. It also reports `BAD lock package not in claro.project: name` when the lockfile contains a package entry that is not listed in `claro.project`, so learners know to refresh the lockfile instead of trusting stale package data. The project file must declare the complete supported `manifest-version: 1` value; a prefix such as `manifest-version: 10` is rejected as `BAD project manifest version: expected 1`. Package manifests must declare exactly one complete supported `manifest-version: 1` value. Missing, blank, unsupported (such as `10`), or duplicate format fields report `BAD package manifest version` with the package name, the manifest path, and a hint to keep exactly one `manifest-version: 1` line. The doctor leaves the file unchanged for you to repair; an absent manifest file still reports `MISSING package manifest`. They must also declare exactly one expected `name:` value; duplicate or prefix-matching names are rejected as `BAD package manifest name: name`. The manifest must contain exactly one checksum field with the expected complete value; duplicate, trailing, or extra checksum text is rejected as `BAD package checksum: name`. Package manifests must also declare exactly one `version: 1` field; duplicate or prefix-matching versions such as `version: 10` are rejected as `BAD package version: name`. Package manifests must also declare the complete supported local `source: local` value. Prefixes such as `source: local-extra` are rejected as `BAD package source: name` rather than being accepted as valid local manifests.
## Safety rules If `package doctor` reports `BAD package source: math-tools`, open `packages/math-tools/claro.package` and keep exactly one `source: local` line. Duplicate `source:` lines are rejected even when both say `local`, or when a valid line appears before or after an unsupported source. The doctor leaves the file unchanged so you can review and repair it yourself.
If `package doctor` reports `BAD lock checksum: math-tools`, check the `math-tools` entry in `claro.lock`. Each package must have exactly one matching `checksum:` line. Duplicate checksums are rejected even when they agree, or when a correct checksum appears before or after an incorrect one. The doctor leaves the file unchanged. After reviewing your project and package manifests, run `claro package lock` to regenerate the lockfile, then run `claro package doctor` again.
## Lock format safety
`claro package doctor` requires exactly one `lock-version: 1` line in `claro.lock`. Missing, empty, unsupported (such as `10`), or duplicate format versions now fail with:
```text
BAD lock version: expected exactly one lock-version: 1 line
```
The lockfile must also contain exactly one current release line, `version: v1.18.26`. A missing, stale, blank, or duplicate release line fails with:
```text
BAD lock release version: expected exactly one version: v1.18.26 line
```
The doctor leaves your files unchanged. After reviewing your project and package manifests, run `claro package lock` to regenerate the lockfile, then run `claro package doctor` again. Spaces around values and capitalization of the lock-format field name are accepted, as with other lockfile fields. Valid generated lockfiles continue to work unchanged; this check does not add registry downloads or verify package content hashes.
## Project-name safety
`claro new NAME` checks the project name before creating folders. Project names may use only letters, numbers, dash, and underscore, and they must be 64 characters or fewer.
This keeps mistakes like `../bad` from creating a project outside the folder where the learner is working.
## Package-name safety
Package names may use only: Package names may use only:
@@ -76,6 +102,8 @@ dash
underscore underscore
``` ```
Package names must be 64 characters or fewer so Claro can create predictable local package folders and metadata paths.
This means simple names like these are allowed: This means simple names like these are allowed:
```text ```text
@@ -93,6 +121,8 @@ folder/name
bad name bad name
``` ```
If an unsafe package name somehow gets into `claro.project`, package maintenance commands should not quietly continue. `claro package doctor` points out the bad name, `claro package lock` refuses to write lockfile data for it, `claro package list` refuses to display it as a normal package, `claro package init` refuses to report the project ready while the unsafe entry remains, and `claro package remove NAME` exits with an error if the lockfile refresh still sees an unsafe package name after the removal. Learners can still recover by removing the exact unsafe entry, such as `claro package remove ../bad`; Claro rewrites the project file and lockfile without using that unsafe name as a folder path.
## Why this matters ## Why this matters
Packages are important for Claro's future, but the workflow must stay friendly: Packages are important for Claro's future, but the workflow must stay friendly:
+173 -23
View File
File diff suppressed because one or more lines are too long
+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env python3
"""Regression tests for the CI workflow release-gate validator."""
import importlib.util
from pathlib import Path
import unittest
ROOT = Path(__file__).resolve().parents[1]
SPEC = importlib.util.spec_from_file_location(
"validate_ci_workflow", ROOT / "tools" / "validate_ci_workflow.py"
)
MODULE = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(MODULE)
class ValidateCiWorkflowTests(unittest.TestCase):
def test_accepts_release_gate_commands_in_run_steps(self):
workflow = """
steps:
- name: Build
run: make
- name: Release gates
run: ./claro validate
- name: Type diagnostics
run: python3 tools/validate_typecheck_diagnostics.py
- name: Version
run: python3 tools/validate_version_convention.py
- name: Packages
run: python3 tools/validate_package_security.py
- name: Compiler warnings
run: python3 tools/validate_compiler_warnings.py
- name: CI workflow
run: python3 tools/validate_ci_workflow.py
"""
self.assertEqual(MODULE.missing_release_gates(workflow), [])
def test_requires_the_workflow_validator_to_run_in_ci(self):
self.assertIn("python3 tools/validate_ci_workflow.py", MODULE.REQUIRED_COMMANDS)
def test_rejects_commands_that_only_appear_in_comments(self):
workflow = """
steps:
# run: ./claro validate
# python3 tools/validate_typecheck_diagnostics.py
- name: Build
run: make
"""
self.assertEqual(
MODULE.missing_release_gates(workflow), MODULE.REQUIRED_COMMANDS
)
if __name__ == "__main__":
unittest.main()
+34
View File
@@ -0,0 +1,34 @@
import json
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_ide_metadata_lists_current_typed_function_keywords():
result = subprocess.run(
["python3", "tools/validate_ide_metadata.py"],
cwd=ROOT,
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
assert result.returncode == 0, result.stdout
assert result.stdout.strip() == "IDE metadata validation OK"
def test_ide_metadata_is_valid_json_with_keyword_list():
result = subprocess.run(
["./claro", "ide"],
cwd=ROOT,
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
check=True,
)
metadata = json.loads(result.stdout)
assert "RETURNS" in metadata["keywords"]
assert "CHECK" in metadata["keywords"]
assert "TYPE" in metadata["keywords"]
@@ -0,0 +1,414 @@
#!/usr/bin/env python3
"""Regression tests for complete typecheck fixture coverage."""
import importlib.util
from pathlib import Path
import subprocess
import unittest
ROOT = Path(__file__).resolve().parents[1]
SPEC = importlib.util.spec_from_file_location(
"validate_typecheck_diagnostics", ROOT / "tools" / "validate_typecheck_diagnostics.py"
)
MODULE = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(MODULE)
class ValidateTypecheckDiagnosticsTests(unittest.TestCase):
def test_lists_every_typecheck_fixture(self):
listed = set(MODULE.EXPECTED) | set(MODULE.EXPECTED_OK)
fixtures = {
str(path.relative_to(ROOT))
for path in (ROOT / "tests").glob("typecheck_*.claro")
}
fixtures.add("tests/37_object_field_types.claro")
self.assertEqual(listed, fixtures)
def test_includes_modern_chained_alias_method_success_fixture(self):
self.assertIn(
"tests/typecheck_object_alias_method_do_good.claro",
MODULE.EXPECTED_OK,
)
def test_has_compatibility_chained_alias_method_extra_arg_fixture(self):
self.assertTrue(
(ROOT / "tests/typecheck_object_alias_method_call_extra_arg_bad.claro").exists()
)
def test_includes_dedicated_yesno_field_check_success_fixture(self):
self.assertIn(
"tests/typecheck_object_field_check_type_yesno_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_reverse_text_concatenation_success_fixture(self):
self.assertIn(
"tests/typecheck_object_field_text_concat_reverse_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_typed_function_return_fixtures(self):
self.assertIn("tests/typecheck_function_return_bad.claro", MODULE.EXPECTED)
self.assertIn("tests/typecheck_function_return_good.claro", MODULE.EXPECTED_OK)
def test_includes_compatibility_missing_return_type_fixture(self):
self.assertIn(
"tests/typecheck_function_compat_missing_return_type_bad.claro",
MODULE.EXPECTED,
)
def test_includes_function_return_arithmetic_success_fixture(self):
self.assertIn(
"tests/typecheck_function_return_multiplication_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_unknown_function_return_expression_fixtures(self):
self.assertIn(
"tests/typecheck_function_unknown_return_expression_bad.claro",
MODULE.EXPECTED,
)
self.assertIn(
"tests/typecheck_function_unknown_return_expression_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_unknown_compatibility_function_return_expression_fixture(self):
self.assertIn(
"tests/typecheck_function_compat_unknown_return_expression_bad.claro",
MODULE.EXPECTED,
)
def test_includes_missing_object_name_fixture(self):
self.assertIn(
"tests/typecheck_missing_object_name_bad.claro",
MODULE.EXPECTED,
)
def test_includes_missing_expected_check_type_fixture(self):
self.assertIn(
"tests/typecheck_missing_expected_type_bad.claro",
MODULE.EXPECTED,
)
def test_includes_missing_type_of_expression_fixture(self):
self.assertIn(
"tests/typecheck_missing_type_of_expression_bad.claro",
MODULE.EXPECTED,
)
def test_includes_lowercase_compatibility_return_success_fixture(self):
self.assertIn(
"tests/typecheck_function_lowercase_return_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_lowercase_compatibility_syntax_return_success_fixture(self):
self.assertIn(
"tests/typecheck_function_compat_lowercase_return_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_missing_function_return_fixture(self):
self.assertIn("tests/typecheck_function_missing_return_bad.claro", MODULE.EXPECTED)
def test_includes_missing_method_return_type_fixtures(self):
self.assertIn("tests/typecheck_method_missing_return_type_bad.claro", MODULE.EXPECTED)
self.assertIn("tests/typecheck_method_compat_missing_return_type_bad.claro", MODULE.EXPECTED)
def test_includes_branch_missing_function_return_fixture(self):
self.assertIn("tests/typecheck_function_branch_missing_return_bad.claro", MODULE.EXPECTED)
def test_includes_compatibility_branch_missing_function_return_fixture(self):
self.assertIn(
"tests/typecheck_function_compat_branch_missing_return_bad.claro",
MODULE.EXPECTED,
)
def test_includes_compatibility_branch_complete_function_return_fixture(self):
self.assertIn(
"tests/typecheck_function_compat_branch_complete_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_empty_function_return_fixture(self):
self.assertIn("tests/typecheck_function_empty_return_bad.claro", MODULE.EXPECTED)
def test_includes_extra_return_tokens_fixture(self):
self.assertIn(
"tests/typecheck_function_return_extra_tokens_bad.claro",
MODULE.EXPECTED,
)
def test_includes_compatibility_function_extra_return_tokens_fixture(self):
self.assertIn(
"tests/typecheck_function_compat_return_extra_tokens_bad.claro",
MODULE.EXPECTED,
)
def test_includes_compatibility_function_empty_return_fixture(self):
self.assertIn(
"tests/typecheck_function_compat_empty_return_bad.claro",
MODULE.EXPECTED,
)
def test_includes_empty_compatibility_method_return_fixture(self):
self.assertIn(
"tests/typecheck_method_compat_empty_return_bad.claro",
MODULE.EXPECTED,
)
def test_includes_missing_method_return_fixture(self):
self.assertIn("tests/typecheck_method_missing_return_bad.claro", MODULE.EXPECTED)
def test_includes_typed_method_return_expression_fixtures(self):
self.assertIn("tests/typecheck_method_return_expression_bad.claro", MODULE.EXPECTED)
self.assertIn("tests/typecheck_method_return_expression_good.claro", MODULE.EXPECTED_OK)
def test_includes_unknown_method_return_expression_fixtures(self):
self.assertIn(
"tests/typecheck_method_unknown_return_expression_bad.claro",
MODULE.EXPECTED,
)
self.assertIn(
"tests/typecheck_method_unknown_return_expression_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_method_field_return_diagnostic_fixture(self):
self.assertIn("tests/typecheck_method_field_return_bad.claro", MODULE.EXPECTED)
self.assertIn("tests/typecheck_method_field_return_good.claro", MODULE.EXPECTED_OK)
def test_includes_compatibility_method_field_return_fixtures(self):
self.assertIn("tests/typecheck_method_compat_field_return_bad.claro", MODULE.EXPECTED)
self.assertIn("tests/typecheck_method_compat_field_return_good.claro", MODULE.EXPECTED_OK)
def test_includes_compatibility_method_return_success_fixture(self):
self.assertIn("tests/typecheck_method_compat_return_good.claro", MODULE.EXPECTED_OK)
def test_includes_compatibility_method_multiplication_return_success_fixture(self):
self.assertIn(
"tests/typecheck_method_compat_return_multiplication_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_compatibility_method_addition_return_success_fixture(self):
self.assertIn(
"tests/typecheck_method_compat_return_addition_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_compatibility_method_addition_return_diagnostic_fixture(self):
self.assertIn(
"tests/typecheck_method_compat_return_addition_bad.claro",
MODULE.EXPECTED,
)
def test_includes_compatibility_method_subtraction_return_diagnostic_fixture(self):
self.assertIn(
"tests/typecheck_method_compat_return_subtraction_bad.claro",
MODULE.EXPECTED,
)
def test_includes_compatibility_method_division_return_diagnostic_fixture(self):
self.assertIn(
"tests/typecheck_method_compat_return_division_bad.claro",
MODULE.EXPECTED,
)
def test_includes_compatibility_method_multiplication_return_diagnostic_fixture(self):
self.assertIn(
"tests/typecheck_method_compat_return_multiplication_bad.claro",
MODULE.EXPECTED,
)
def test_includes_compatibility_function_arithmetic_return_success_fixture(self):
self.assertIn(
"tests/typecheck_function_compat_return_addition_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_compatibility_function_subtraction_return_success_fixture(self):
self.assertIn(
"tests/typecheck_function_compat_return_subtraction_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_compatibility_function_division_return_success_fixture(self):
self.assertIn(
"tests/typecheck_function_compat_return_division_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_compatibility_function_multiplication_return_success_fixture(self):
self.assertIn(
"tests/typecheck_function_compat_return_multiplication_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_compatibility_function_missing_return_fixture(self):
self.assertIn(
"tests/typecheck_function_compat_missing_return_bad.claro",
MODULE.EXPECTED,
)
def test_includes_lowercase_compatibility_method_return_success_fixture(self):
self.assertIn(
"tests/typecheck_method_compat_lowercase_return_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_compatibility_missing_method_argument_fixture(self):
self.assertIn(
"tests/typecheck_method_call_missing_unchecked_arg_bad.claro",
MODULE.EXPECTED,
)
def test_includes_method_field_assignment_diagnostic_fixture(self):
self.assertIn(
"tests/typecheck_method_field_assignment_bad.claro",
MODULE.EXPECTED,
)
def test_includes_method_field_assignment_success_fixture(self):
self.assertIn(
"tests/typecheck_method_field_assignment_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_compatibility_unknown_method_field_assignment_fixture(self):
self.assertIn(
"tests/typecheck_method_compat_unknown_field_bad.claro",
MODULE.EXPECTED,
)
def test_includes_typed_method_unknown_field_diagnostics(self):
self.assertIn(
"tests/typecheck_method_unknown_field_typed_bad.claro",
MODULE.EXPECTED,
)
self.assertIn(
"tests/typecheck_method_compat_unknown_field_typed_bad.claro",
MODULE.EXPECTED,
)
def test_includes_explicitly_typed_method_field_assignment_diagnostic(self):
self.assertIn(
"tests/typecheck_method_typed_field_assignment_bad.claro",
MODULE.EXPECTED,
)
def test_includes_method_text_field_assignment_diagnostic_fixture(self):
self.assertIn(
"tests/typecheck_method_text_field_assignment_bad.claro",
MODULE.EXPECTED,
)
def test_includes_method_text_field_assignment_success_fixture(self):
self.assertIn(
"tests/typecheck_method_text_field_assignment_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_method_text_concatenation_success_fixture(self):
self.assertIn(
"tests/typecheck_method_text_concat_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_compatibility_method_text_concatenation_success_fixture(self):
self.assertIn(
"tests/typecheck_method_compat_text_concat_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_yesno_method_field_assignment_diagnostics(self):
self.assertIn(
"tests/typecheck_method_yesno_field_assignment_bad.claro",
MODULE.EXPECTED,
)
self.assertIn(
"tests/typecheck_method_compat_yesno_field_assignment_bad.claro",
MODULE.EXPECTED,
)
def test_includes_compatibility_yesno_method_field_assignment_success_fixture(self):
self.assertIn(
"tests/typecheck_method_compat_yesno_field_assignment_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_compatibility_number_method_field_assignment_success_fixture(self):
self.assertIn(
"tests/typecheck_method_compat_field_assignment_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_method_field_check_type_fixtures(self):
self.assertIn(
"tests/typecheck_method_field_check_type_bad.claro",
MODULE.EXPECTED,
)
self.assertIn(
"tests/typecheck_method_field_check_type_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_compatibility_method_field_check_type_fixtures(self):
self.assertIn(
"tests/typecheck_method_compat_field_check_type_bad.claro",
MODULE.EXPECTED,
)
self.assertIn(
"tests/typecheck_method_compat_field_check_type_good.claro",
MODULE.EXPECTED_OK,
)
def test_includes_yesno_method_field_check_type_success_fixture(self):
self.assertIn(
"tests/typecheck_method_yesno_field_check_type_good.claro",
MODULE.EXPECTED_OK,
)
def test_release_validation_runs_method_field_diagnostic_fixtures(self):
source = (ROOT / "src" / "claro.c").read_text()
for fixture in (
"tests/typecheck_method_field_assignment_bad.claro",
"tests/typecheck_method_text_field_assignment_bad.claro",
"tests/typecheck_method_compat_text_field_assignment_bad.claro",
"tests/typecheck_method_yesno_field_assignment_bad.claro",
"tests/typecheck_method_compat_yesno_field_assignment_bad.claro",
"tests/typecheck_method_field_check_type_bad.claro",
"tests/typecheck_method_compat_unknown_field_bad.claro",
"tests/typecheck_method_unknown_field_typed_bad.claro",
"tests/typecheck_method_compat_unknown_field_typed_bad.claro",
"tests/typecheck_duplicate_field_bad.claro",
):
self.assertIn(f'"{fixture}"', source)
def test_release_validation_runs_compatibility_function_missing_return_fixture(self):
source = (ROOT / "src" / "claro.c").read_text()
self.assertIn(
'"tests/typecheck_function_compat_missing_return_bad.claro"',
source,
)
def test_release_validation_runs_method_call_fixture(self):
result = subprocess.run(
[str(ROOT / "claro"), "validate"],
cwd=ROOT,
capture_output=True,
text=True,
)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertIn("tests/typecheck_method_call_bad.claro", result.stdout)
self.assertIn(
'"tests/typecheck_method_compat_lowercase_return_good.claro"',
(ROOT / "src" / "claro.c").read_text(),
)
self.assertIn(
'"tests/typecheck_method_compat_return_multiplication_bad.claro"',
(ROOT / "src" / "claro.c").read_text(),
)
if __name__ == "__main__":
unittest.main()
@@ -0,0 +1,7 @@
CLASS Player
HAS score NUMBER
END
CLASS Player
HAS name TEXT
END
@@ -0,0 +1,7 @@
CLASS Player
HAS score NUMBER
HAS score TEXT
END
NEW Player player
SET player.score 10
@@ -0,0 +1,7 @@
TEACH greet name
SAY name
END
TEACH greet person
SAY person
END
@@ -0,0 +1,6 @@
CLASS Player
HAS score NUMBER
END
NEW Player player
NEW Player player
@@ -0,0 +1,2 @@
SET score NUMBER 10
CHECK TYPE score IS NUMBER TEXT
@@ -0,0 +1,5 @@
CLASS Player Extra
HAS score NUMBER
END
NEW Player player
@@ -0,0 +1,5 @@
CLASS Player
HAS score NUMBER TEXT
END
NEW Player player
@@ -0,0 +1,5 @@
CLASS Player
HAS score NUMBER
END
NEW Player player extra
@@ -0,0 +1,3 @@
TEACH greet RETURNS NUMBER extra
RETURN 1
END
@@ -0,0 +1,2 @@
SET score NUMBER 10
TYPE OF score AS kind extra
@@ -0,0 +1,9 @@
TEACH choose flag RETURNS NUMBER
IF flag
RETURN 1
ELSE
RETURN 2
END
END
DO choose YES
@@ -0,0 +1,5 @@
TEACH choose flag RETURNS NUMBER
IF flag
RETURN 1
END
END
@@ -0,0 +1,5 @@
TEACH greet name
SAY name
END
CALL greet WITH
@@ -0,0 +1,6 @@
TEACH square amount
CHECK TYPE amount IS NUMBER
SAY amount
END
CALL squre WITH 4
@@ -0,0 +1,9 @@
TEACH choose TAKES flag RETURNS NUMBER
IF flag
RETURN 1
ELSE
RETURN 2
END
LEARNED
CALL choose WITH YES
@@ -0,0 +1,5 @@
TEACH choose TAKES flag RETURNS NUMBER
IF flag
RETURN 1
END
LEARNED
@@ -0,0 +1,4 @@
TEACH greet TAKES name, name
SAY name
LEARNED
CALL greet WITH "Ada", "Grace"
@@ -0,0 +1,4 @@
TEACH square TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN
LEARNED
@@ -0,0 +1,6 @@
TEACH square TAKES amount returns NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount
LEARNED
CALL square WITH 4
@@ -0,0 +1,3 @@
TEACH square TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
LEARNED
@@ -0,0 +1,3 @@
TEACH greet TAKES name RETURNS
RETURN name
LEARNED
@@ -0,0 +1,6 @@
TEACH total TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount + 1
LEARNED
CALL total WITH 4
@@ -0,0 +1,6 @@
TEACH square TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN "oops"
LEARNED
CALL square WITH 4
@@ -0,0 +1,6 @@
TEACH total TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount / 2
LEARNED
CALL total WITH 4
@@ -0,0 +1,3 @@
TEACH square TAKES amount RETURNS NUMBER
RETURN amount extra
LEARNED
@@ -0,0 +1,6 @@
TEACH square TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount
LEARNED
CALL square WITH 4
@@ -0,0 +1,6 @@
TEACH total TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount * 2
LEARNED
CALL total WITH 4
@@ -0,0 +1,6 @@
TEACH total TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount - 1
LEARNED
CALL total WITH 4
@@ -0,0 +1,4 @@
TEACH square TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN missing
LEARNED
@@ -0,0 +1,4 @@
TEACH greet name, name
SAY name
END
DO greet "Ada", "Grace"
@@ -0,0 +1,4 @@
TEACH square amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN
END
@@ -0,0 +1,6 @@
TEACH square amount
CHECK TYPE amount IS NUMBER
SAY amount
END
DO square 5, 6
@@ -0,0 +1,5 @@
TEACH square amount returns NUMBER
RETURN "oops"
END
DO square 4
@@ -0,0 +1,6 @@
TEACH square TAKES amount returns NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount
LEARNED
CALL square WITH 4
@@ -0,0 +1,6 @@
TEACH square amount
CHECK TYPE amount IS NUMBER
SAY amount
END
DO square
@@ -0,0 +1,5 @@
TEACH square amount RETURNS NUMBER
SAY amount
END
DO square 4
@@ -0,0 +1,5 @@
TEACH greet name
SAY name
END
DO greet
@@ -0,0 +1,13 @@
TEACH choose flag RETURNS NUMBER
IF flag
IF flag
RETURN 1
ELSE
RETURN 2
END
ELSE
RETURN 3
END
END
DO choose YES
@@ -0,0 +1,4 @@
TEACH total amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount + "oops"
END
@@ -0,0 +1,6 @@
TEACH square amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN "oops"
END
DO square 4
@@ -0,0 +1,4 @@
TEACH total amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount / "oops"
END
@@ -0,0 +1,6 @@
TEACH halve amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount / 2
END
DO halve 8
@@ -0,0 +1,4 @@
TEACH label amount RETURNS TEXT
CHECK TYPE amount IS NUMBER
RETURN amount + 1
END
@@ -0,0 +1,4 @@
TEACH square amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount + 1
END
@@ -0,0 +1,3 @@
TEACH square amount RETURNS NUMBER
RETURN amount extra
END
@@ -0,0 +1,6 @@
TEACH square amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount
END
DO square 4
@@ -0,0 +1,4 @@
TEACH total amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount * "oops"
END
@@ -0,0 +1,6 @@
TEACH scale amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount * 2
END
DO scale 3
@@ -0,0 +1,4 @@
TEACH total amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount - "oops"
END
@@ -0,0 +1,6 @@
TEACH difference amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount - 2
END
DO difference 5
@@ -0,0 +1,6 @@
TEACH square amount
CHECK TYPE amount IS NUMBER
SAY amount
END
DO squre 4
@@ -0,0 +1,3 @@
TEACH square amount RETURNS NUMBER
RETURN missing
END
@@ -0,0 +1,4 @@
TEACH square amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount
END
@@ -0,0 +1,2 @@
SET score NUMBER 10
CHECK TYPE score IS BANANA
@@ -0,0 +1,3 @@
TEACH square amount RETURNS BANANA
RETURN amount
END
@@ -0,0 +1,7 @@
CLASS Player
TEACH choose flag RETURNS NUMBER
IF flag
RETURN 1
END
END
END
+11
View File
@@ -0,0 +1,11 @@
CLASS Player
HAS score NUMBER
TEACH add points
CHECK TYPE points IS NUMBER
SET score score + points
END
END
NEW Player player
CALL player.add WITH "five"
+11
View File
@@ -0,0 +1,11 @@
CLASS Player
HAS score NUMBER
TEACH add points
CHECK TYPE points IS NUMBER
SET score score + points
END
END
NEW Player player
CALL player.add WITH 5
@@ -0,0 +1,10 @@
CLASS Player
HAS name TEXT
TEACH rename newName
SET name newName
END
END
NEW Player player
CALL player.rename WITH
@@ -0,0 +1,11 @@
CLASS Player
HAS score NUMBER
TEACH add points
CHECK TYPE points IS NUMBER
SET score score + points
END
END
NEW Player player
CALL player.fly WITH 5
@@ -0,0 +1,10 @@
CLASS Player
HAS score NUMBER
TEACH add points
CHECK TYPE points IS NUMBER
SET score score + points
END
END
CALL player.add WITH 5
@@ -0,0 +1,10 @@
CLASS Player
HAS score NUMBER
TEACH add points
CHECK TYPE points IS NUMBER
SET score score + points
END
END
CALL player.fly WITH 5
@@ -0,0 +1,12 @@
CLASS Player
TEACH show TAKES
SAY "first"
LEARNED
TEACH show TAKES
SAY "second"
LEARNED
END
NEW Player player
CALL player.show WITH
@@ -0,0 +1,8 @@
CLASS Player
TEACH greet TAKES name, name
SAY name
LEARNED
ENDCLASS
NEW Player player
CALL player.greet WITH "Ada", "Grace"
@@ -0,0 +1,5 @@
CLASS Player
TEACH score TAKES amount RETURNS NUMBER
RETURN
LEARNED
ENDCLASS
@@ -0,0 +1,9 @@
CLASS Player
HAS score NUMBER
TEACH add TAKES amount
SET score amount + 1
LEARNED
ENDCLASS
NEW Player player
CALL player.add WITH 4
@@ -0,0 +1,9 @@
CLASS Player
HAS name TEXT
TEACH rename TAKES replacement
CHECK TYPE name IS NUMBER
LEARNED
ENDCLASS
NEW Player player
CALL player.rename WITH "Ada"
@@ -0,0 +1,9 @@
CLASS Player
HAS name TEXT
TEACH rename TAKES replacement
CHECK TYPE name IS TEXT
LEARNED
ENDCLASS
NEW Player player
CALL player.rename WITH "Ada"
@@ -0,0 +1,7 @@
CLASS Player
HAS score NUMBER
TEACH label TAKES amount RETURNS TEXT
RETURN score
LEARNED
ENDCLASS
@@ -0,0 +1,10 @@
CLASS Player
HAS score NUMBER
TEACH score_value TAKES amount RETURNS NUMBER
RETURN score
LEARNED
ENDCLASS
NEW Player player
CALL player.score_value WITH 4
@@ -0,0 +1,10 @@
CLASS Player
HAS score NUMBER
TEACH set_score TAKES value
SET score TEXT 10
LEARNED
END
NEW Player player
CALL player.set_score WITH 10
@@ -0,0 +1,10 @@
CLASS Player
HAS score NUMBER
TEACH set_score TAKES value
SET score NUMBER 10
LEARNED
END
NEW Player player
CALL player.set_score WITH 10
@@ -0,0 +1,10 @@
CLASS Player
HAS score NUMBER
TEACH set_score TAKES value
SET score AS BANANA TO 10
LEARNED
END
NEW Player player
CALL player.set_score WITH 10
@@ -0,0 +1,8 @@
CLASS Player
TEACH score TAKES amount returns NUMBER
RETURN "oops"
LEARNED
END
NEW Player player
CALL player.score WITH 4
@@ -0,0 +1,9 @@
CLASS Player
TEACH score TAKES amount returns NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount
LEARNED
END
NEW Player player
CALL player.score WITH 4
@@ -0,0 +1,5 @@
CLASS Player
TEACH score TAKES amount RETURNS
RETURN amount
LEARNED
END
@@ -0,0 +1,6 @@
CLASS Player
TEACH total TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount + "oops"
LEARNED
ENDCLASS
@@ -0,0 +1,9 @@
CLASS Player
TEACH score TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount + 2
LEARNED
ENDCLASS
NEW Player player
CALL player.score WITH 4
@@ -0,0 +1,9 @@
CLASS Player
TEACH score TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN "oops"
LEARNED
ENDCLASS
NEW Player player
CALL player.score WITH 4
@@ -0,0 +1,6 @@
CLASS Player
TEACH total TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount / "oops"
LEARNED
ENDCLASS
@@ -0,0 +1,9 @@
CLASS Player
TEACH score TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount / 2
LEARNED
ENDCLASS
NEW Player player
CALL player.score WITH 4
@@ -0,0 +1,6 @@
CLASS Player
HAS score NUMBER
TEACH total TAKES amount RETURNS NUMBER
RETURN amount extra
LEARNED
END
@@ -0,0 +1,9 @@
CLASS Player
TEACH score TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount
LEARNED
ENDCLASS
NEW Player player
CALL player.score WITH 4
@@ -0,0 +1,6 @@
CLASS Player
TEACH total TAKES amount RETURNS NUMBER
CHECK TYPE amount IS NUMBER
RETURN amount * "oops"
LEARNED
ENDCLASS

Some files were not shown because too many files have changed in this diff Show More