frontend: validate unknown effect names before body lowering
This commit is contained in:
1 parent
4c9c5626c9
commit
762c5abe7b
40 files changed
+335
-9
No files matched your search
@@ -387,7 +387,7 @@ A byte string or array used where a `slice<u8>` is expected is materialized in f
|
||||
- **Frame storage.** Addressability is a property of lowering, not of source types. Linear values (owners, regions, resources, endpoints, tasks, mutexes) never get frame storage: they are borrowed in place. A variable whose name is borrowed, indexed, or written through a field or element anywhere in the function lowers to `local<T>` storage, allocated in the entry block (spec 08 §11.5). Every other variable is an SSA value. The decision is by name, so the same source always gives the same placement. The frame-size limit applies to the lowered AIR. There is no implicit heap allocation.
|
||||
- **Borrow scopes.** A borrow bound by `ref`/`mut` ends at the end of the block that contains the binding. Because a borrow's name is not visible after its scope, a use after the borrow ended (`E2106`) cannot be written in source. A temporary borrow, used directly as an operand, ends at the end of its statement. Both end at every normal exit from their scope, except the named returned borrow and its owned ancestors transferred under §19. The frontend emits `borrow.end` in reverse order of creation. A borrow that must end earlier is placed in an inner block. Borrows lent to tasks end at the join (spec 04 §34).
|
||||
- **Features.** The frontend emits the `features [...]` header as the dependency closure of the constructs used, always including `effects`.
|
||||
- **Effects.** They are declared by the programmer. `E3101` names the missing effect and suggests the complete effect list (`suggested_effects`).
|
||||
- **Effects.** They are declared by the programmer. Every function/template/static-function contract MUST use registered atoms (`reference/effects.md`); an unknown atom MUST reject E7002 with `name` and `effect`, before body lowering. The source position is the function start, or the static parameter start for its contract. Ordinary signature type/`from` checks and existing template/header check order remain prior checks. Ordinary effect lists retain AIR set semantics; static-function contract effects remain unique (§18). `E3101` names the missing effect and suggests the complete effect list (`suggested_effects`).
|
||||
|
||||
## 10. Diagnostics
|
||||
|
||||
@@ -431,7 +431,7 @@ Its diagnostics keep their AIR codes, reported at the source location.
|
||||
| Code | Kind | Meaning |
|
||||
|---|---|---|
|
||||
| E7001 | source.syntax | Malformed `.aji` source |
|
||||
| E7002 | source.unknown_name | Undefined variable, function, type, field or variant |
|
||||
| E7002 | source.unknown_name | Undefined variable, function, type, field, variant or effect |
|
||||
| E7003 | source.missing_move | Named linear value consumed without `move` |
|
||||
| E7004 | source.not_exhaustive | `match` misses an outcome, variant or default |
|
||||
| E7005 | source.type_mismatch | Expression has the wrong type in a source position |
|
||||
|
||||
Reference in new issue
Block a user