Repository navigation
throw is the only keyword for failing functions (stage 1) - #3640
Conversation
|
Important Review skippedToo 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.
|
sha=2dab0da5fca798387ac6fd7e0065b8deef4781a1
🤖 Salam AI reviewVerdict: 🛠️ Changes needed before merging commit SummaryThis pull request makes What changedThe parser now accepts Review
TestsThe added RisksThis 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
|
|
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. |
Salam had two keywords for one idea:
throwsmarked a failing function andthrowraised the error. This makesthrowthe 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
throwafter 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 writesthrow. It stays quiet for files understd/andcompiler/until stage 2.پرتاب خطا, the same as the statement.salam formatrewritesthrowstothrow(خطادارtoپرتاب خطا).compiler/i18n.salamkept in step).throws; completion lists and the AI keyword lists drop it.throw.Examples
The old spelling:
Converted files (outside compiler/ and std/)
Tests added
throwin a signature runsthrowRun 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)
throwsin std/: 46 files, 199 signatures. compiler/ has none.throws/خطادارkeywords fromcompiler/langpack.salam,TK_KW_THROWS,p_warn_old_throws, W234 and its i18n strings, the formatter rewrite.throwsuntil then:.github/scripts/ai_pr_review.salam,tools/salam/abicheck.salam,tools/salam/check-snippets.salam.throws: the protobuf generator emits it, sotests/en/stdlib/protobuf_*, the two protobuf std-examples andencoding-protobuf-codegen.outmatch it.tools/mcp/mcp_prompts.salamand the MCP search word inmcp_guide.salam.