diff --git a/docs/ADVANCED_STATIC_TYPING.md b/docs/ADVANCED_STATIC_TYPING.md index 2d27370..aa41a01 100644 --- a/docs/ADVANCED_STATIC_TYPING.md +++ b/docs/ADVANCED_STATIC_TYPING.md @@ -128,6 +128,14 @@ 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 still deliberately reports only the type it can infer; full operator-specific rules remain future work. `CHECK TYPE` also preserves TEXT field metadata through the same chained aliases: diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.md index 46de70f..98dbe0d 100644 --- a/docs/CURRENT_STATUS.md +++ b/docs/CURRENT_STATUS.md @@ -57,7 +57,7 @@ Ready now: Still needed: - Keep the focused typecheck validator's fixture list complete as new positive and negative examples are added. -- The expression checker now carries a known TEXT operand through all arithmetic operators so object-field diagnostics do not hide subtraction, multiplication, or division mistakes; focused numeric-division and text-operand subtraction, multiplication, and division fixtures protect this behavior, while operator-specific diagnostics remain planned. +- The expression checker now carries a known TEXT operand through all arithmetic operators so object-field diagnostics do not hide subtraction, multiplication, or division mistakes; focused numeric-division and numeric-multiplication positives plus text-operand subtraction, multiplication, and division negatives protect this behavior, while operator-specific diagnostics remain planned. - richer typed function signatures and return values - type checking through branches and loops - richer object field type checking beyond simple direct assignments diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index fc14ab9..4a4d500 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -36,7 +36,7 @@ See `CURRENT_STATUS.md` for the detailed feature matrix. 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, 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: every `typecheck_*.claro` fixture, including positive fixtures, must be exercised by release validation. -6. Continue narrowing expression diagnostics: known TEXT operands now remain visible through non-concatenation arithmetic, with focused numeric-division plus text-operand subtraction, multiplication, and division coverage; operator-specific guidance is still future work. +6. Continue narrowing expression diagnostics: known TEXT operands now remain visible through non-concatenation arithmetic, with focused numeric-division and numeric-multiplication positives plus text-operand subtraction, multiplication, and division coverage; operator-specific guidance is still future work. ## Complete-platform milestones diff --git a/tests/typecheck_object_field_multiplication_good.claro b/tests/typecheck_object_field_multiplication_good.claro new file mode 100644 index 0000000..c67d10c --- /dev/null +++ b/tests/typecheck_object_field_multiplication_good.claro @@ -0,0 +1,7 @@ +CLASS Player + HAS score NUMBER +END + +NEW Player player +SET player.score 10 +SET player.score player.score * 2 diff --git a/tools/validate_typecheck_diagnostics.py b/tools/validate_typecheck_diagnostics.py index 4de6d80..2ce9297 100644 --- a/tools/validate_typecheck_diagnostics.py +++ b/tools/validate_typecheck_diagnostics.py @@ -175,6 +175,7 @@ EXPECTED_OK = [ "tests/typecheck_object_field_expression_good.claro", "tests/typecheck_object_field_compound_good.claro", "tests/typecheck_object_field_division_good.claro", + "tests/typecheck_object_field_multiplication_good.claro", "tests/typecheck_object_field_text_good.claro", "tests/typecheck_object_field_yesno_good.claro", "tests/typecheck_object_field_check_type_number_good.claro",