Skip to content

fix(ast): guard all unsafe .at() type lookups against missing keys - #171

Merged
wizardengineer merged 1 commit into
mainfrom
fix/safe-type-lookup
Apr 17, 2026
Merged

fix(ast): guard all unsafe .at() type lookups against missing keys#171
wizardengineer merged 1 commit into
mainfrom
fix/safe-type-lookup

Conversation

@wizardengineer

@wizardengineer wizardengineer commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Add get_serialized_type() safe lookup wrapper to TypeBuilder that returns an empty QualType instead of throwing std::out_of_range when a type key is missing. Logs a warning for debugging.

Migrates all 13 call sites across ASTConsumer, FunctionBuilder, OperationBuilder, and OperationStmt from:
type_builder().get_serialized_types().at(key)
to:
type_builder().get_serialized_type(key)

Fixes #145

@wizardengineer wizardengineer changed the title fix(ast): guard all unsafe .at() type lookups against missing keys (#… fix(ast): guard all unsafe .at() type lookups against missing keys Mar 18, 2026
Adds GetSerializedType(key) to TypeBuilder that returns an empty
QualType with a warning log instead of throwing std::out_of_range
when the key is missing.

Migrates 13 .at() call sites across ASTConsumer, FunctionBuilder,
OperationBuilder, and OperationStmt.

Supersedes #171 (rebased onto current main after the Pascal-case
rename in #148).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@wizardengineer

Copy link
Copy Markdown
Contributor Author

once the CI finishes, I'll merge it. Thanks for the review @kyle-elliott-tob !

@wizardengineer
wizardengineer merged commit a363ad3 into main Apr 17, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unsafe .at() without .contains() on type map causing out_of_range exceptions

2 participants