diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-10-08 20:18:48 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-10-08 20:18:48 +0200 |
| commit | ea902858825aac806cd282e6d5f02ec683a995e3 (patch) | |
| tree | ed61b48a185dcdeff557887fbf0da0b6e6340113 | |
| parent | 7d07bef760a8807fe49fbe5c90799a1822f95973 (diff) | |
| download | elna-ea902858825aac806cd282e6d5f02ec683a995e3.tar.gz | |
Fix ICE with local block variables
| -rw-r--r-- | boot/type_check.cc | 10 | ||||
| -rw-r--r-- | include/elna/boot/type_check.h | 2 | ||||
| -rw-r--r-- | testsuite/compilable/block_variables.elna | 8 |
3 files changed, 20 insertions, 0 deletions
diff --git a/boot/type_check.cc b/boot/type_check.cc index d8a9170..31e10f1 100644 --- a/boot/type_check.cc +++ b/boot/type_check.cc @@ -1506,6 +1506,16 @@ namespace elna::boot } // else callable is not declared, or inference failed and reported. } + + void type_analysis_visitor::visit(defer_statement *statement) + { + traverse_block(statement->body); + } + + void type_analysis_visitor::visit(block_statement *statement) + { + traverse_block(statement->body); + } void type_analysis_visitor::visit(record_constructor_expression *expression) { diff --git a/include/elna/boot/type_check.h b/include/elna/boot/type_check.h index 5a2d7f1..d9a07b9 100644 --- a/include/elna/boot/type_check.h +++ b/include/elna/boot/type_check.h @@ -317,6 +317,8 @@ namespace elna::boot void visit(repeat_statement *statement) override; void visit(while_statement *statement) override; void visit(if_statement *statement) override; + void visit(defer_statement *statement) override; + void visit(block_statement *statement) override; void visit(record_constructor_expression *expression) override; void visit(array_constructor_expression *expression) override; void visit(traits_expression *trait) override; diff --git a/testsuite/compilable/block_variables.elna b/testsuite/compilable/block_variables.elna new file mode 100644 index 0000000..c67e8b6 --- /dev/null +++ b/testsuite/compilable/block_variables.elna @@ -0,0 +1,8 @@ +program() + +begin + block b + var + x: Int + end +end. |
