d517c62380
ci / build (ubuntu) (push) Has been cancelled
ci / unit + fmt (push) Has been cancelled
ci / examples (push) Has been cancelled
ci / goldens + tools (push) Has been cancelled
ci / apps (push) Has been cancelled
ci / selfhost smoke (push) Has been cancelled
ci / macos smoke (push) Has been cancelled
ci / windows smoke (push) Has been cancelled
ci / CI gate (push) Has been cancelled
selfhost-loop / bootstrap determinism (push) Has been cancelled
- feat: generic enum support (parser, lowering, codegen — both selfhost + bootstrap)
- enum Result<T,E> { Ok(T), Err(E) } parsing + monomorphization
- tag constant mangling in monomorphized function bodies
- data field access (l-value + r-value) for generated enum instances
- multiple concrete instances in same file
- HIR walker for enum reference mangling (selfhost + bootstrap)
- feat: stdlib Result<T,E> and Option<T> made truly generic
- breaking: explicit type args required (Result<int, String>)
- fix: 'is' operator — lowering to hBinary tag comparison + C backend fallback
- fix: Type_Eq structural comparison (inner types for pointer/slice/tuple)
- fix: hardcoded limit diagnostics (>8 params/variants/captures now emit errors)
- docs: Iter<T> safety warning for dangling pointer
- docs: IMPROVEMENTS.md — comprehensive plan and changelog
- test: generic_enum example added to EXAMPLES
All tests pass (0 FAIL). Selfhost loop deterministic.
2.8 KiB
2.8 KiB
Bux — План за подобрения (post-v1.0.0)
Дата: 2026-07-28
Статус: Всички приоритетни задачи изпълнени ✅
Свършено (3 сесии, 13 файла, +608/-96 реда)
Сесия 1 — Критични бъгове
| # | Задача | Файлове |
|---|---|---|
| B.1 | Грешки при хардкоднати лимити (>8 param/variant/capture) | src/parser.bux |
| B.2 | is оператор — lowering + codegen |
src/hir_lower.bux, src/c_backend.bux |
| B.3 | Enum type param парсване (enum Result<T,E>) |
src/parser.bux |
| B.4 | Type_Eq структурно сравнение |
src/types.bux |
| B.6 | Iter<T> safety документация |
lib/Iter.bux |
| B.8 | Generic enum lowering (selfhost) | src/hir_lower.bux |
| B.9 | Generic enum lowering (Nim bootstrap) | bootstrap/ast.nim, bootstrap/parser.nim, bootstrap/hir_lower.nim |
Сесия 2 — Tag/type манглинг
| # | Задача | Файлове |
|---|---|---|
| B.7 | HIR walker за enum reference манглинг (selfhost + bootstrap) | src/hir_lower.bux, bootstrap/hir_lower.nim |
| — | generic_enum example + test | examples/generic_enum.bux, Makefile |
Сесия 3 — Data field достъп + Stdlib
| # | Задача | Файлове |
|---|---|---|
| B.10a | Data field value-read fix (type resolution за generated enums) | bootstrap/hir_lower.nim |
| B.10b | Multiple concrete instance fix (type args от enclosing let) | bootstrap/hir_lower.nim |
| B.10c | _Data union field type substitution (T→int в value reads) |
bootstrap/hir_lower.nim |
| B.11 | Result<T,E> и Option<T> генерични |
lib/Result.bux, lib/Option.bux, examples/map_remove.bux, tests/stdlib_golden/collections/src/Main.bux |
Резултат
- Всички тестове: 0 FAIL, 0 error
- Selfhost loop: детерминистичен (C + ELF identical)
- Generic enum-ите работят end-to-end:
- Парсване с type параметри
- Tag проверки (
p.tag == Pair_First) - Data field достъп (
p.data.First_0като l-value и r-value) - Множество конкретни инстанции в един файл
Result<T,E>иOption<T>в stdlib
Пример който работи
enum Pair<T, U> {
First(T), Second(U),
}
func Main() -> int {
let p: Pair<int, String> = Pair_MakeFirst<int, String>(42);
if p.tag == Pair_First {
PrintInt(p.data.First_0 as int64); // → 42
}
let s: Pair<String, int> = Pair_MakeSecond<String, int>(99);
if s.tag == Pair_Second {
PrintInt(s.data.Second_0 as int64); // → 99
}
return 0;
}