Skip to content

throw is the only keyword for failing functions (stage 1) - #3640

Merged
BaseMax merged 10 commits into
mainfrom
feat/throw-keyword
Nov 18, 2026
Merged

BaseMax merged 10 commits into
mainfrom
feat/throw-keyword

Conversation

@BaseMax

@BaseMax BaseMax commented Nov 18, 2026

Copy link
Copy Markdown
Member

Salam had two keywords for one idea: throws marked a failing function and throw raised the error. This makes throw the only one. It is stage 1 of two: the compiler and std sources are still built by the released compiler (the seed), so they cannot use the new spelling yet.

What changes

  • The parser accepts throw after the return type, or after the parameters when there is none. Same places as before: functions, methods, interface methods, function types.
  • throws (Persian خطادار) still compiles and means the same, but reports a new warning, W234, with a quick fix that writes throw. It stays quiet for files under std/ and compiler/ until stage 2.
  • Persian: the signature word is now پرتاب خطا, the same as the statement.
  • salam format rewrites throws to throw (خطادار to پرتاب خطا).
  • Messages E155 to E157 style hints now say 'throw' (en and fa, compiler/i18n.salam kept in step).
  • Editor grammars are regenerated without throws; completion lists and the AI keyword lists drop it.
  • Every example, test, doc, learn page, blog and magazine article, book and the agent skill write throw.

Examples

func parse port(text: str): int throw:
    if text == "":
        throw Error.New(ErrorKind.InvalidArgument, "empty port")
    end
    ret text.ToInt()
end
تابع درگاه(متن: رشته): صحیح پرتاب خطا:
    اگر متن برابر "":
        پرتاب خطا "درگاه خالی است"
    پایان
    برگشت متن.به صحیح()
پایان

The old spelling:

warning[W234]: 'throws' is deprecated, use 'throw'
 --> a.salam:1:24
  = help: write 'throw' after the signature; 'throws' is the old spelling and will be removed

Converted files (outside compiler/ and std/)

  • tests: 108 en, 28 fa (plus new tests below)
  • website content: 142 en, 142 fa (examples, std-examples, learn, std pages, blog)
  • books: 1, docs, SKILL.md and the MCP skill copy: 8
  • extensions (regenerated grammars): 6, editor/ai/tools: 9

Tests added

  • tests/{en,fa}/features/throw_signature: throw in a signature runs
  • tests/{en,fa}/features/throws_alias: the old spelling still runs
  • tests/{en,fa}/lint/throws_deprecated: W234 count, fix and message
  • tests/{en,fa}/fmt/throws_alias: formatter output uses throw

Run with a compiler built from this branch: fmt, lint, translate, errors sections plus the throw and try feature tests. Existing failures that also fail on main and are unrelated: fmt comparison_spacing, percent_color, tuples, fa messy, fa persian_syntax; lint range_* and a few fix/*; translate cases that trip over with_code; fa feature files using ==.

Left for stage 2 (after the next release)

  • throws in std/: 46 files, 199 signatures. compiler/ has none.
  • Remove the throws/خطادار keywords from compiler/langpack.salam, TK_KW_THROWS, p_warn_old_throws, W234 and its i18n strings, the formatter rewrite.
  • Three scripts run by the released compiler in CI keep throws until then: .github/scripts/ai_pr_review.salam, tools/salam/abicheck.salam, tools/salam/check-snippets.salam.
  • Text that mirrors std output keeps throws: the protobuf generator emits it, so tests/en/stdlib/protobuf_*, the two protobuf std-examples and encoding-protobuf-codegen.out match it.
  • The reserved word list in tools/mcp/mcp_prompts.salam and the MCP search word in mcp_guide.salam.

@BaseMax
BaseMax requested a review from a team as a code owner November 18, 2026 12:15
@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 440 files, which is 340 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

Usage-priced reviews support at most 300 files.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f7b42bd8-7f9d-4eff-9fd7-e6fa13d677a0
Commits

Reviewing files that changed from the base of the PR and between 298bcf4 and 2dab0da.

Files ignored due to path filters: 6

  • tests/en/features/throw_signature.out is excluded by !**/*.out
  • tests/en/features/throws_alias.out is excluded by !**/*.out
  • tests/en/fmt/throws_alias.out is excluded by !**/*.out
  • tests/fa/features/throw_signature.out is excluded by !**/*.out
  • tests/fa/features/throws_alias.out is excluded by !**/*.out
  • tests/fa/fmt/throws_alias.out is excluded by !**/*.out
Files selected for processing: 440

  • SKILL.md
  • ai/backend/policy.salam
  • ai/backend/tests/policy_test.salam
  • ai/frontend/src/Keys.tsx
  • ai/frontend/src/highlight.ts
  • books/en/intro-programming/chapters/17-stdlib-2.tex
  • compiler/i18n.salam
  • compiler/parser/parser_cursor.salam
  • compiler/parser/parser_decl.salam
  • compiler/sal_fmt.salam
  • compiler/semantic/sema_throws.salam
  • compiler/semantic/sema_try.salam
  • docs/ai/AGENTS.md
  • docs/design/THROW.md
  • docs/design/TUPLES.md
  • editor/complete.salam
  • extensions/emacs/salam-mode.el
  • extensions/sublime/Salam.sublime-completions
  • extensions/tools/gen_syntaxes.salam
  • extensions/tree-sitter-salam/keywords.json
  • extensions/tree-sitter-salam/src/keywords.h
  • extensions/vim/syntax/salam.vim
  • tests/en/apps/auth/api_refresh.salam
  • tests/en/apps/auth/jwt_inspect.salam
  • tests/en/apps/auth/jwt_passwords.salam
  • tests/en/apps/blogapi/main.salam
  • tests/en/apps/encodepipe/main.salam
  • tests/en/apps/todoapi/main.salam
  • tests/en/db/mylive_roundtrip.salam
  • tests/en/db/tslive_ex_keys.salam
  • tests/en/errors/throw_wrong_type.salam
  • tests/en/errors/throws_call_unmarked.salam
  • tests/en/errors/throws_void_ret_value.salam
  • tests/en/errors/try_in_until_cond.salam
  • tests/en/errors/try_nothing_throws.salam
  • tests/en/errors/try_outside_throws.salam
  • tests/en/exec/throws_basic.salam
  • tests/en/exec/try_in_expr.salam
  • tests/en/features/_throws_shadow_pkg.salam
  • tests/en/features/main_throws.salam
  • tests/en/features/main_throws_int.salam
  • tests/en/features/throw_signature.salam
  • tests/en/features/throws_alias.salam
  • tests/en/features/throws_basic.salam
  • tests/en/features/throws_method_iface.salam
  • tests/en/features/throws_void.salam
  • tests/en/features/try_catch_literal.salam
  • tests/en/features/try_in_expr.salam
  • tests/en/features/tuples_compose.salam
  • tests/en/fmt/optional_throws.golden
  • tests/en/fmt/optional_throws.salam
  • tests/en/fmt/throws_alias.golden
  • tests/en/fmt/throws_alias.salam
  • tests/en/fmt/throws_blocks.golden
  • tests/en/fmt/throws_blocks.salam
  • tests/en/general/conv_pkg.salam
  • tests/en/general/encoding_url.salam
  • tests/en/general/enctest.salam
  • tests/en/general/json_key_order.salam
  • tests/en/general/net_email_misc.salam
  • tests/en/general/optional_type_json.salam
  • tests/en/general/optional_type_json_null.salam
  • tests/en/general/regex_basic.salam
  • tests/en/general/regex_capture.salam
  • tests/en/general/regex_extract.salam
  • tests/en/general/regex_replaceall.salam
  • tests/en/general/regex_replaceall_cases.salam
  • tests/en/general/stdlib2.salam
  • tests/en/general/stdlib4.salam
  • tests/en/js/str_bytes.salam
  • tests/en/js/throws_basic.salam
  • tests/en/js/tuples_compose.salam
  • tests/en/lint/throws_deprecated.salam
  • tests/en/llvm/throw_str.salam
  • tests/en/llvm/throws_basic.salam
  • tests/en/llvm/tuples_compose.salam
  • tests/en/stdlib/binary_demo.salam
  • tests/en/stdlib/binary_edgecases_demo.salam
  • tests/en/stdlib/binary_errors_demo.salam
  • tests/en/stdlib/binary_signed_16.salam
  • tests/en/stdlib/conv_errors_demo.salam
  • tests/en/stdlib/conv_native_digits.salam
  • tests/en/stdlib/csv_edgecases_demo.salam
  • tests/en/stdlib/csv_errors_demo.salam
  • tests/en/stdlib/csv_value_demo.salam
  • tests/en/stdlib/data_csv_demo.salam
  • tests/en/stdlib/data_idx_demo.salam
  • tests/en/stdlib/encoding_demo.salam
  • tests/en/stdlib/excel_demo.salam
  • tests/en/stdlib/gguf_demo.salam
  • tests/en/stdlib/grpc_demo.salam
  • tests/en/stdlib/json_errors_demo.salam
  • tests/en/stdlib/json_value_demo.salam
  • tests/en/stdlib/jwt_demo.salam
  • tests/en/stdlib/jwt_errors_demo.salam
  • tests/en/stdlib/msgpack_bin_ext_demo.salam
  • tests/en/stdlib/msgpack_demo.salam
  • tests/en/stdlib/nn_ckpt_demo.salam
  • tests/en/stdlib/npy_demo.salam
  • tests/en/stdlib/protobuf_codegen_demo.salam
  • tests/en/stdlib/protobuf_errors_demo.salam
  • tests/en/stdlib/protobuf_groups_demo.salam
  • tests/en/stdlib/protobuf_parse_demo.salam
  • tests/en/stdlib/protobuf_roundtrip_demo.salam
  • tests/en/stdlib/protobuf_wire_demo.salam
  • tests/en/stdlib/protobuf_wire_edgecases_demo.salam
  • tests/en/stdlib/query_demo.salam
  • tests/en/stdlib/query_edgecases_demo.salam
  • tests/en/stdlib/regex_errors_demo.salam
  • tests/en/stdlib/regex_extra.salam
  • tests/en/stdlib/serde_demo.salam
  • tests/en/stdlib/stdlib_demo.salam
  • tests/en/stdlib/tensor_io_demo.salam
  • tests/en/stdlib/time_duration_demo.salam
  • tests/en/stdlib/time_parse_demo.salam
  • tests/en/stdlib/tls_coverage.salam
  • tests/en/stdlib/toml_demo.salam
  • tests/en/stdlib/toml_multiline_demo.salam
  • tests/en/stdlib/url_join_dots.salam
  • tests/en/stdlib/url_parse_demo.salam
  • tests/en/stdlib/url_query_demo.salam
  • tests/en/stdlib/xml_demo.salam
  • tests/en/stdlib/xml_document_demo.salam
  • tests/en/stdlib/xml_edgecases_demo.salam
  • tests/en/stdlib/xml_unescape_utf8.salam
  • tests/en/stdlib/xml_xpath_variables_demo.salam
  • tests/en/translate/throws.salam
  • tests/fa/db/tslive_ex_keys.salam
  • tests/fa/errors/throws_void_ret_value.salam
  • tests/fa/errors/try_without_result_return.salam
  • tests/fa/errors/type_english_name.salam
  • tests/fa/features/main_throws.salam
  • tests/fa/features/main_throws_int.salam
  • tests/fa/features/main_throws_pkg.salam
  • tests/fa/features/throw_signature.salam
  • tests/fa/features/throws_alias.salam
  • tests/fa/features/throws_basic.salam
  • tests/fa/features/try_catch_literal.salam
  • tests/fa/fmt/throws_alias.golden
  • tests/fa/fmt/throws_alias.salam
  • tests/fa/general/encoding_fa_names.salam
  • tests/fa/general/optional_type_json_null.salam
  • tests/fa/general/regex_basic.salam
  • tests/fa/general/regex_extract.salam
  • tests/fa/lint/throws_deprecated.salam
  • tests/fa/llvm/throw_str.salam
  • tests/fa/stdlib/conv_errors.salam
  • tests/fa/stdlib/protobuf_groups.salam
  • tests/fa/stdlib/regex_extra.salam
  • tests/fa/stdlib/tls_coverage.salam
  • tests/fa/stdlib/xml_xpath_variables.salam
  • tests/fa/translate/throws.salam
  • tools/mcp/claude-plugin/skills/salam-lang/SKILL.md
  • tools/mcp/mcp_guide.salam
  • tools/mcp/mcp_hints.salam
  • tools/mcp/mcp_prompts.salam
  • website/content/en/blog/01-what-is-salam-programming-language.md
  • website/content/en/blog/12-static-typing-in-salam.md
  • website/content/en/blog/19-salam-vs-c.md
  • website/content/en/blog/20-salam-vs-rust.md
  • website/content/en/blog/21-salam-vs-go.md
  • website/content/en/blog/24-salam-vs-cpp.md
  • website/content/en/blog/25-salam-vs-zig.md
  • website/content/en/blog/26-salam-vs-java-and-csharp.md
  • website/content/en/blog/34-salam-standard-library-tour.md
  • website/content/en/blog/47-multilingual-programming-future.md
  • website/content/en/blog/49-what-makes-a-language-production-ready.md
  • website/content/en/examples/bp-design.salam
  • website/content/en/examples/conv-guide-floats.salam
  • website/content/en/examples/conv-guide-settings.salam
  • website/content/en/examples/conv-guide-sum.salam
  • website/content/en/examples/data-columns.salam
  • website/content/en/examples/data-mnist-format.salam
  • website/content/en/examples/data-regression.salam
  • website/content/en/examples/db-redis-counters.salam
  • website/content/en/examples/encoding-binary-guide-endian.salam
  • website/content/en/examples/encoding-binary-guide-frames.salam
  • website/content/en/examples/encoding-binary-guide-header.salam
  • website/content/en/examples/encoding-binary-guide-png.salam
  • website/content/en/examples/encoding-csv-guide-export.salam
  • website/content/en/examples/encoding-csv-guide-json.salam
  • website/content/en/examples/encoding-csv-guide-pitfalls.salam
  • website/content/en/examples/encoding-csv-guide-report.salam
  • website/content/en/examples/encoding-json-guide-dynamic.salam
  • website/content/en/examples/encoding-json-guide-ndjson.salam
  • website/content/en/examples/encoding-msgpack-guide-cache.salam
  • website/content/en/examples/encoding-msgpack-guide-errors.salam
  • website/content/en/examples/encoding-msgpack-guide-size.salam
  • website/content/en/examples/encoding-protobuf-decode-loop.salam
  • website/content/en/examples/encoding-protobuf-nested.salam
  • website/content/en/examples/encoding-protobuf-packed.salam
  • website/content/en/examples/encoding-query-guide-allow.salam
  • website/content/en/examples/encoding-query-guide-form.salam
  • website/content/en/examples/encoding-query-guide-pages.salam
  • website/content/en/examples/encoding-serde-guide-migrate.salam
  • website/content/en/examples/encoding-toml-guide-manifest.salam
  • website/content/en/examples/encoding-toml-guide-write.salam
  • website/content/en/examples/encoding-url-guide-build.salam
  • website/content/en/examples/encoding-url-guide-clean.salam
  • website/content/en/examples/encoding-url-guide-links.salam
  • website/content/en/examples/encoding-url-guide-site.salam
  • website/content/en/examples/encoding-value-guide-edit.salam
  • website/content/en/examples/encoding-value-guide-merge.salam
  • website/content/en/examples/encoding-value-guide-walk.salam
  • website/content/en/examples/encoding-xml-guide-config.salam
  • website/content/en/examples/encoding-xml-guide-namespaces.salam
  • website/content/en/examples/encoding-xml-guide-rss.salam
  • website/content/en/examples/error-guide-layers.salam
  • website/content/en/examples/error-guide-retry.salam
  • website/content/en/examples/error-guide-validate.salam
  • website/content/en/examples/excel-lookup.salam
  • website/content/en/examples/gguf-guide-errors.salam
  • website/content/en/examples/gguf-guide-sizes.salam
  • website/content/en/examples/gguf-guide-weights.salam
  • website/content/en/examples/grpc-guide-protobuf.salam
  • website/content/en/examples/jwt-errors.salam
  • website/content/en/examples/jwt-key-rotation.salam
  • website/content/en/examples/jwt-refresh.salam
  • website/content/en/examples/net-http-validate-rules.salam
  • website/content/en/examples/nn-guide-checkpoint.salam
  • website/content/en/examples/npy-checkpoint.salam
  • website/content/en/examples/npy-header.salam
  • website/content/en/examples/npy-shapes.salam
  • website/content/en/examples/npy-weights.salam
  • website/content/en/examples/regex-guide-logs.salam
  • website/content/en/examples/regex-guide-persian.salam
  • website/content/en/examples/regex-guide-rewrite.salam
  • website/content/en/examples/regex-guide-validate.salam
  • website/content/en/examples/rules-exit.salam
  • website/content/en/examples/stats-guide-parse.salam
  • website/content/en/examples/types-guide-form.salam
  • website/content/en/learn/15-enums.txt
  • website/content/en/learn/19-rules.txt
  • website/content/en/learn/48-best-practices.txt
  • website/content/en/std-examples/ai-gguf/ai-gguf-Read.salam
  • website/content/en/std-examples/ai-llm/ai-llm-Load.salam
  • website/content/en/std-examples/ai-nn/ai-nn-Layers.salam
  • website/content/en/std-examples/ai-tensor/ai-tensor-Create.salam
  • website/content/en/std-examples/conv/conv-ParseFloat.salam
  • website/content/en/std-examples/conv/conv-ParseInt.salam
  • website/content/en/std-examples/core/core-Error.At.salam
  • website/content/en/std-examples/core/core-Error.New.salam
  • website/content/en/std-examples/core/core-Error.is.salam
  • website/content/en/std-examples/core/core-Error.salam
  • website/content/en/std-examples/core/core-Error.with_code.salam
  • website/content/en/std-examples/core/core-Error.with_path.salam
  • website/content/en/std-examples/core/core-Error.wrap.salam
  • website/content/en/std-examples/data/data-Batch.salam
  • website/content/en/std-examples/data/data-Table.salam
  • website/content/en/std-examples/encoding-binary/encoding-binary-ReadWrite.salam
  • website/content/en/std-examples/encoding-csv/encoding-csv-Table.salam
  • website/content/en/std-examples/encoding-json/encoding-json-Value.salam
  • website/content/en/std-examples/encoding-msgpack/encoding-msgpack-Marshal.salam
  • website/content/en/std-examples/encoding-protobuf/encoding-protobuf-Generate.salam
  • website/content/en/std-examples/encoding-protobuf/encoding-protobuf-Parse.salam
  • website/content/en/std-examples/encoding-protobuf/encoding-protobuf-Wire.salam
  • website/content/en/std-examples/encoding-query/encoding-query-Query.salam
  • website/content/en/std-examples/encoding-toml/encoding-toml-Decode.salam
  • website/content/en/std-examples/encoding-url/encoding-url-Parse.salam
  • website/content/en/std-examples/encoding-value/encoding-value-Value.field.salam
  • website/content/en/std-examples/encoding-xml/encoding-xml-Build.salam
  • website/content/en/std-examples/encoding-xml/encoding-xml-DTD.salam
  • website/content/en/std-examples/encoding-xml/encoding-xml-Parse.salam
  • website/content/en/std-examples/encoding-xml/encoding-xml-Simple.salam
  • website/content/en/std-examples/encoding-xml/encoding-xml-XPath.salam
  • website/content/en/std-examples/encoding-yaml/encoding-yaml-Build.salam
  • website/content/en/std-examples/excel/excel-Convert.salam
  • website/content/en/std-examples/jwt/jwt-Algorithms.salam
  • website/content/en/std-examples/jwt/jwt-Guard.salam
  • website/content/en/std-examples/jwt/jwt-Sign.salam
  • website/content/en/std-examples/net-http-validate/net-http-validate-Check.salam
  • website/content/en/std-examples/npy/npy-Npy.salam
  • website/content/en/std-examples/regex/regex-Compile.salam
  • website/content/en/std-examples/regex/regex-Expand.salam
  • website/content/en/std-examples/regex/regex-FindAll.salam
  • website/content/en/std-examples/regex/regex-Group.salam
  • website/content/en/std-examples/time/time-Duration.salam
  • website/content/en/std-examples/time/time-UTC.salam
  • website/content/en/std-examples/tls/tls-Crypto.salam
  • website/content/en/std/01-core.txt
  • website/content/en/std/04-conv.txt
  • website/content/en/std/116-gguf.txt
  • website/content/en/std/120-nn.txt
  • website/content/en/std/43-error.txt
  • website/content/en/std/46-time.txt
  • website/content/en/std/54-encoding.txt
  • website/content/en/std/55-encoding-json.txt
  • website/content/en/std/57-encoding-csv.txt
  • website/content/en/std/58-encoding-toml.txt
  • website/content/en/std/59-encoding-url.txt
  • website/content/en/std/60-encoding-query.txt
  • website/content/en/std/65-encoding-msgpack.txt
  • website/content/en/std/66-encoding-binary.txt
  • website/content/en/std/67-encoding-xml.txt
  • website/content/en/std/68-encoding-protobuf.txt
  • website/content/en/std/71-npy.txt
  • website/content/en/std/73-data.txt
  • website/content/en/std/95-jwt.txt
  • website/content/fa/blog/01-what-is-salam-programming-language.md
  • website/content/fa/blog/12-static-typing-in-salam.md
  • website/content/fa/blog/19-salam-vs-c.md
  • website/content/fa/blog/20-salam-vs-rust.md
  • website/content/fa/blog/21-salam-vs-go.md
  • website/content/fa/blog/24-salam-vs-cpp.md
  • website/content/fa/blog/25-salam-vs-zig.md
  • website/content/fa/blog/26-salam-vs-java-and-csharp.md
  • website/content/fa/blog/34-salam-standard-library-tour.md
  • website/content/fa/blog/47-multilingual-programming-future.md
  • website/content/fa/blog/49-what-makes-a-language-production-ready.md
  • website/content/fa/examples/bp-design.salam
  • website/content/fa/examples/conv-guide-floats.salam
  • website/content/fa/examples/conv-guide-settings.salam
  • website/content/fa/examples/conv-guide-sum.salam
  • website/content/fa/examples/data-columns.salam
  • website/content/fa/examples/data-mnist-format.salam
  • website/content/fa/examples/data-regression.salam
  • website/content/fa/examples/db-redis-counters.salam
  • website/content/fa/examples/encoding-binary-guide-endian.salam
  • website/content/fa/examples/encoding-binary-guide-frames.salam
  • website/content/fa/examples/encoding-binary-guide-header.salam
  • website/content/fa/examples/encoding-binary-guide-png.salam
  • website/content/fa/examples/encoding-csv-guide-export.salam
  • website/content/fa/examples/encoding-csv-guide-json.salam
  • website/content/fa/examples/encoding-csv-guide-pitfalls.salam
  • website/content/fa/examples/encoding-csv-guide-report.salam
  • website/content/fa/examples/encoding-json-guide-dynamic.salam
  • website/content/fa/examples/encoding-json-guide-ndjson.salam
  • website/content/fa/examples/encoding-msgpack-guide-cache.salam
  • website/content/fa/examples/encoding-msgpack-guide-errors.salam
  • website/content/fa/examples/encoding-msgpack-guide-size.salam
  • website/content/fa/examples/encoding-protobuf-decode-loop.salam
  • website/content/fa/examples/encoding-protobuf-nested.salam
  • website/content/fa/examples/encoding-protobuf-packed.salam
  • website/content/fa/examples/encoding-query-guide-allow.salam
  • website/content/fa/examples/encoding-query-guide-form.salam
  • website/content/fa/examples/encoding-query-guide-pages.salam
  • website/content/fa/examples/encoding-serde-guide-migrate.salam
  • website/content/fa/examples/encoding-toml-guide-manifest.salam
  • website/content/fa/examples/encoding-toml-guide-write.salam
  • website/content/fa/examples/encoding-url-guide-build.salam
  • website/content/fa/examples/encoding-url-guide-clean.salam
  • website/content/fa/examples/encoding-url-guide-links.salam
  • website/content/fa/examples/encoding-url-guide-site.salam
  • website/content/fa/examples/encoding-value-guide-edit.salam
  • website/content/fa/examples/encoding-value-guide-merge.salam
  • website/content/fa/examples/encoding-value-guide-walk.salam
  • website/content/fa/examples/encoding-xml-guide-config.salam
  • website/content/fa/examples/encoding-xml-guide-namespaces.salam
  • website/content/fa/examples/encoding-xml-guide-rss.salam
  • website/content/fa/examples/error-guide-layers.salam
  • website/content/fa/examples/error-guide-retry.salam
  • website/content/fa/examples/error-guide-validate.salam
  • website/content/fa/examples/excel-lookup.salam
  • website/content/fa/examples/gguf-guide-errors.salam
  • website/content/fa/examples/gguf-guide-sizes.salam
  • website/content/fa/examples/gguf-guide-weights.salam
  • website/content/fa/examples/grpc-guide-protobuf.salam
  • website/content/fa/examples/jwt-errors.salam
  • website/content/fa/examples/jwt-key-rotation.salam
  • website/content/fa/examples/jwt-refresh.salam
  • website/content/fa/examples/net-http-validate-rules.salam
  • website/content/fa/examples/nn-guide-checkpoint.salam
  • website/content/fa/examples/npy-checkpoint.salam
  • website/content/fa/examples/npy-header.salam
  • website/content/fa/examples/npy-shapes.salam
  • website/content/fa/examples/npy-weights.salam
  • website/content/fa/examples/regex-guide-logs.salam
  • website/content/fa/examples/regex-guide-persian.salam
  • website/content/fa/examples/regex-guide-rewrite.salam
  • website/content/fa/examples/regex-guide-validate.salam
  • website/content/fa/examples/rules-exit.salam
  • website/content/fa/examples/stats-guide-parse.salam
  • website/content/fa/examples/types-guide-form.salam
  • website/content/fa/learn/15-enums.txt
  • website/content/fa/learn/19-rules.txt
  • website/content/fa/learn/48-best-practices.txt
  • website/content/fa/std-examples/ai-gguf/ai-gguf-Read.salam
  • website/content/fa/std-examples/ai-llm/ai-llm-Load.salam
  • website/content/fa/std-examples/ai-nn/ai-nn-Layers.salam
  • website/content/fa/std-examples/ai-tensor/ai-tensor-Create.salam
  • website/content/fa/std-examples/conv/conv-ParseFloat.salam
  • website/content/fa/std-examples/conv/conv-ParseInt.salam
  • website/content/fa/std-examples/core/core-Error.At.salam
  • website/content/fa/std-examples/core/core-Error.New.salam
  • website/content/fa/std-examples/core/core-Error.is.salam
  • website/content/fa/std-examples/core/core-Error.salam
  • website/content/fa/std-examples/core/core-Error.with_code.salam
  • website/content/fa/std-examples/core/core-Error.with_path.salam
  • website/content/fa/std-examples/core/core-Error.wrap.salam
  • website/content/fa/std-examples/data/data-Batch.salam
  • website/content/fa/std-examples/data/data-Table.salam
  • website/content/fa/std-examples/encoding-binary/encoding-binary-ReadWrite.salam
  • website/content/fa/std-examples/encoding-csv/encoding-csv-Table.salam
  • website/content/fa/std-examples/encoding-json/encoding-json-Value.salam
  • website/content/fa/std-examples/encoding-msgpack/encoding-msgpack-Marshal.salam
  • website/content/fa/std-examples/encoding-protobuf/encoding-protobuf-Generate.salam
  • website/content/fa/std-examples/encoding-protobuf/encoding-protobuf-Parse.salam
  • website/content/fa/std-examples/encoding-protobuf/encoding-protobuf-Wire.salam
  • website/content/fa/std-examples/encoding-query/encoding-query-Query.salam
  • website/content/fa/std-examples/encoding-toml/encoding-toml-Decode.salam
  • website/content/fa/std-examples/encoding-url/encoding-url-Parse.salam
  • website/content/fa/std-examples/encoding-value/encoding-value-Value.field.salam
  • website/content/fa/std-examples/encoding-xml/encoding-xml-Build.salam
  • website/content/fa/std-examples/encoding-xml/encoding-xml-DTD.salam
  • website/content/fa/std-examples/encoding-xml/encoding-xml-Parse.salam
  • website/content/fa/std-examples/encoding-xml/encoding-xml-Simple.salam
  • website/content/fa/std-examples/encoding-xml/encoding-xml-XPath.salam
  • website/content/fa/std-examples/encoding-yaml/encoding-yaml-Build.salam
  • website/content/fa/std-examples/excel/excel-Convert.salam
  • website/content/fa/std-examples/jwt/jwt-Algorithms.salam
  • website/content/fa/std-examples/jwt/jwt-Guard.salam
  • website/content/fa/std-examples/jwt/jwt-Sign.salam
  • website/content/fa/std-examples/net-http-validate/net-http-validate-Check.salam
  • website/content/fa/std-examples/npy/npy-Npy.salam
  • website/content/fa/std-examples/regex/regex-Compile.salam
  • website/content/fa/std-examples/regex/regex-Expand.salam
  • website/content/fa/std-examples/regex/regex-FindAll.salam
  • website/content/fa/std-examples/regex/regex-Group.salam
  • website/content/fa/std-examples/time/time-Duration.salam
  • website/content/fa/std-examples/time/time-UTC.salam
  • website/content/fa/std-examples/tls/tls-Crypto.salam
  • website/content/fa/std/01-core.txt
  • website/content/fa/std/04-conv.txt
  • website/content/fa/std/116-gguf.txt
  • website/content/fa/std/120-nn.txt
  • website/content/fa/std/43-error.txt
  • website/content/fa/std/46-time.txt
  • website/content/fa/std/54-encoding.txt
  • website/content/fa/std/55-encoding-json.txt
  • website/content/fa/std/57-encoding-csv.txt
  • website/content/fa/std/58-encoding-toml.txt
  • website/content/fa/std/59-encoding-url.txt
  • website/content/fa/std/60-encoding-query.txt
  • website/content/fa/std/65-encoding-msgpack.txt
  • website/content/fa/std/66-encoding-binary.txt
  • website/content/fa/std/67-encoding-xml.txt
  • website/content/fa/std/68-encoding-protobuf.txt
  • website/content/fa/std/71-npy.txt
  • website/content/fa/std/73-data.txt
  • website/content/fa/std/95-jwt.txt

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

Copy link
Copy Markdown
Contributor
sha=2dab0da5fca798387ac6fd7e0065b8deef4781a1

🤖 Salam AI review

Verdict: 🛠️ Changes needed before merging

commit 2dab0da · 446 files · +1141 −684 · model salam

Summary

This pull request makes throw the sole spelling for failing function signatures while retaining throws as a deprecated alias that reports W234, and updates the parser, formatter, editor grammars, documentation, examples, and tests accordingly. The broad conversion is mostly consistent, but at least one documentation edit introduced a duplicated reserved-word entry and a few parser and i18n details still need confirmation.

What changed

The parser now accepts throw after a return type or parameter list in functions, methods, interface methods, and claimed function-type positions. The old throws spelling still compiles but emits W234 with a quick fix, is suppressed under std/ and compiler/, and is rewritten by salam format. Editor keyword lists, completion data, highlighting, documentation, examples, and tests are converted to throw, while Persian uses پرتاب خطا for both the signature and the statement.

Review

  • docs/ai/AGENTS.md: the reserved-words sentence now reads `try`, `catch`, `throw` and `throw` are reserved too.. This is a duplicate introduced by the conversion; since throws remains valid in stage 1, it should read throw and throws (or otherwise be corrected).
  • compiler/parser/parser_cursor.salam: p_warn_old_throws uses three new i18.Tr(...) strings, but the visible compiler/i18n.salam change is only +2 -2 for E155-E157. Confirm the W234 title, help, and warning strings exist in both English and Persian; otherwise Persian diagnostics may fall back to English.
  • The visible parser changes are in parser_decl.salam and parser_cursor.salam. The PR states function types are also supported, but that path is not visible in the provided diff, so confirm it was updated to use p_at_throws/p_apply_throws.
  • extensions/sublime/Salam.sublime-completions: the diff adds unrelated tab size and touch action style properties. Either justify this as intended regeneration or remove it to keep the change focused.
  • p_throws_quiet_file suppresses W234 using substring checks for /std/ and /compiler/. This could silence warnings for user files whose paths happen to contain those segments; path-prefix checks would be safer.
  • Editor grammars and highlighting drop the deprecated throws/خطادار even though stage 1 still accepts them. Confirm that losing keyword highlighting for old code is the intended deprecation UX.

Tests

The added throw_signature, throws_alias, throws_deprecated, and throws_alias formatter tests cover both spellings and the W234 fix. The large mechanical test conversion appears consistent in the visible files. Several modified files were not shown in the diff, including Persian lint tests, so their expectations should be checked against the English counterparts. The PR also correctly notes pre-existing unrelated failures.

Risks

This is a 446-file change, so missed signature sites (especially function types) or incomplete i18n entries are the main risks. Stage 2 will still need to remove throws/خطادار from the compiler, standard library, and remaining tooling references.

The diff was too large for the model, so some files were not analysed.


⚠️ This review was written automatically by an AI and may contain mistakes. It is a helper for maintainers, not a replacement for a human review: check the code yourself before merging.

@BaseMax
BaseMax merged commit 2ef387b into main Nov 18, 2026
12 checks passed
@BaseMax
BaseMax deleted the feat/throw-keyword branch November 18, 2026 12:19
@BaseMax

BaseMax commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

Review notes: the reserved-words sentence in docs/ai/AGENTS.md is fixed. The W234 strings (title and help, en and fa) are in compiler/i18n.salam (the E155 to E157 messages are the only other i18n change). Function types go through p_apply_throws in parser_type.salam. The sublime completions diff is the generator catching up with style properties added on main. Dropping throws from editor keyword lists is intended: old code still compiles and warns, but is no longer highlighted as a keyword.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant