feat(lang): a name is defined once, a local once per block, and a result is always returned

L1. Two vars, consts, enums, properties or events of one name in a program are an error naming
both places (functions already were); the first used to win silently. A let / var of a name its
own block already declared is an error (it used to shadow). A function with a result type whose
body can reach its end without a return is an error, asked structurally of the body - a return,
an if/else or a match with a default arm whose every branch ends - rather than handing back
whatever the result slot held. The game, the lab and every package example pass all three;
the lab had one harmless shadow, and the game's split screens had two real bugs of the kind.
examples/rejected/ holds the four refusals, checked by the test runner's new reject_case.
Seed regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-23 23:55:20 +03:00
parent c57eafcacc
commit dc75a5a5ab
13 changed files with 46652 additions and 44931 deletions

View file

@ -0,0 +1,8 @@
bump: minor
type: feat
**A name is defined once, for every kind of declaration.** Two functions with one name were
already an error; two `var`s or `const`s (or an enum and a const), or two `property` / `event`
records, kept the first definition silently. A game lost months to it: two files both said
`KEY_LEFT`, one meaning an arrow key's code and one a binding slot, and the menus read the slot.
They are now an error that names both files and lines. `examples/rejected/` holds the two cases,
checked by a new `reject_case` in the test runner (an example the compiler must refuse).

View file

@ -0,0 +1,9 @@
bump: minor
type: feat
**A local is declared once per block, and a function returns what it says it returns.** A second
`let` or `var` of a name in the same block used to shadow the first silently - a settings page
compared a vegetation setting against the volumetric one because of it - and is now an error.
Names declared in different blocks, loop variables and parameters are unaffected. And a function
with a result type that can reach the end of its body without a `return` is an error: it used
to hand back whatever its result slot held, which is how a self-test split into helpers
reported FAILED for a step that had passed. `examples/rejected/` holds both.