Enforce exhaustive matches for AST nodes
This commit addresses the critical rule regarding exhaustive `match` expressions on AST node kinds. By explicitly listing all variants instead of using wildcards (`_ =>`), we ensure that new AST node types are consciously handled throughout the compilation pipeline. This practice prevents subtle bugs and makes the compiler more robust against future changes. The `CLAUDE.md` file has been updated to reflect this critical rule. The deleted `BUG_program_node_typeinference.md` file indicates that a previously identified bug related to type inference with `Program` nodes has been resolved, likely as a consequence of enforcing these exhaustive matches.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
## Rust
|
||||
|
||||
* Performance: Bevorzuge `Rc<dyn Trait>` + lokales `downcast_ref` gegenüber Deep Copies via `Rc::new(obj.clone())`.
|
||||
* CRITICAL: Keine Wildcards (`_ =>`, `other => other`) in `match`-Ausdrücken auf `NodeKind` oder `SyntaxKind`. Alle Varianten müssen explizit aufgeführt werden. Exhaustive Matches erzwingen, dass neue Varianten an jeder Stelle bewusst behandelt werden.
|
||||
|
||||
## Interaktion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user