typecheck: diagnose unknown return expressions

This commit is contained in:
Hermes Agent
2026-09-11 03:22:05 +00:00
parent b7d19db8a9
commit 34f96a6d7d
8 changed files with 42 additions and 5 deletions
+4
View File
@@ -31,6 +31,9 @@ EXPECTED = {
"tests/typecheck_function_return_expression_bad.claro": [
"tests/typecheck_function_return_expression_bad.claro:3: Type mismatch for return from label: expected TEXT, but this value looks like NUMBER.",
],
"tests/typecheck_function_unknown_return_expression_bad.claro": [
"tests/typecheck_function_unknown_return_expression_bad.claro:2: Function square's return value could not be understood yet. Use a NUMBER expression after RETURN.",
],
"tests/typecheck_function_missing_return_bad.claro": [
"tests/typecheck_function_missing_return_bad.claro:3: Function square declares RETURNS NUMBER but has no RETURN statement. Add RETURN with a NUMBER value.",
],
@@ -236,6 +239,7 @@ EXPECTED_OK = [
"tests/typecheck_function_compat_lowercase_return_good.claro",
"tests/typecheck_function_lowercase_return_good.claro",
"tests/typecheck_function_return_expression_good.claro",
"tests/typecheck_function_unknown_return_expression_good.claro",
"tests/typecheck_function_branch_complete_good.claro",
"tests/typecheck_function_nested_branch_complete_good.claro",
"tests/typecheck_method_return_good.claro",