plan: aggregate consts (PLAN-CONST-AGG) + file 0116 const-write hole
Array-typed '::' consts as immutable globals (approved design: storage global + untyped inference + comptime-fold layer + const-write rejection covering the pre-existing struct-const write crash, issue 0116).
This commit is contained in:
@@ -572,7 +572,8 @@ Wiring a new bundling step:
|
||||
| `current/CHECKPOINT-LANG.md` | **Active** LANG progress tracker. Update after every step. |
|
||||
| `current/PLAN-ERR.md` | **Active** ERR implementation plan (`!` errors, `try` / `catch` / `or` / `onfail`, return traces). |
|
||||
| `current/CHECKPOINT-ERR.md` | **Active** ERR progress tracker. Update after every step. |
|
||||
| `current/PLAN-STDLIB.md` | **Active** STDLIB restructure plan (alias carry rule + std/ffi/math layout). Progress tracked in its `## Status` section — no separate checkpoint file. |
|
||||
| `current/PLAN-STDLIB.md` | STDLIB restructure plan — **COMPLETE** (alias carry rule + std/ffi/math layout + full namespace tail). |
|
||||
| `current/PLAN-CONST-AGG.md` | **Active** aggregate-consts plan (array-typed `::` consts as immutable globals, const-write rejection, comptime folds). Progress tracked in its `## Status` section — no separate checkpoint file. |
|
||||
| `implementation_plan.md` | Archive of completed work (closures, protocols, etc.). Do not pick up tasks from here. |
|
||||
| `readme.md` | User-facing language overview — **maintained**. Update it whenever a user-facing sx change lands (new/changed syntax, semantics, gating diagnostics, language behavior), per the docs-track-changes rule. |
|
||||
| `CLAUDE.md` | This file. Session instructions. |
|
||||
|
||||
33
issues/0116-const-write-not-rejected.md
Normal file
33
issues/0116-const-write-not-rejected.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# 0116 — writes through module consts are not rejected (struct-const write bus-errors at runtime)
|
||||
|
||||
**Symptom.** Assigning through a module-level constant compiles silently.
|
||||
For a struct-literal const the store lands in read-only memory and the
|
||||
program crashes at runtime.
|
||||
|
||||
- **Observed**: compiles; `Bus error` at runtime on the store.
|
||||
- **Expected**: compile-time diagnostic — `cannot assign through constant
|
||||
'WHITE'`.
|
||||
|
||||
## Reproduction
|
||||
|
||||
```sx
|
||||
#import "modules/std.sx";
|
||||
|
||||
Color :: struct { r, g, b: s64; }
|
||||
WHITE :: Color.{ r = 255, g = 255, b = 255 };
|
||||
|
||||
main :: () {
|
||||
WHITE.r = 0; // compiles; bus error at runtime
|
||||
print("{}\n", WHITE.r);
|
||||
}
|
||||
```
|
||||
|
||||
(Copies are fine and stay fine: `w := WHITE; w.r = 0;` mutates the copy.)
|
||||
|
||||
## Fix
|
||||
|
||||
Scheduled as **step 2 of `current/PLAN-CONST-AGG.md`** (aggregate consts):
|
||||
one rejection rule for assignment/compound-assignment targets whose ROOT
|
||||
identifier resolves to a module const (module_const_map author) or a
|
||||
const-flagged global (the array consts that plan introduces). Diagnose at
|
||||
the assignment site; pin the repro above as a diagnostics example.
|
||||
Reference in New Issue
Block a user