vx-lang / vx-lang/Vx

Refactor `unwrap()` and type signatures in `src/codegen/generator.rs` to use `Result`

Open
#161 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

codegen help wanted refactor
Dominant language
Rust
Stars
14
Forks
2
Avg merge
12h 42m
Merged PRs (30d)
61

Description

Description

During the codegen panic cleanup pass, over 340 unwrap() calls were safely removed from src/codegen/lower/. However, some heavy .unwrap() usages remain in src/codegen/generator.rs, primarily inside coerce_type and lower_type.

Changing these functions to return Result<..., LowerError> currently cascades into over 100+ type mismatch errors across the compiler because they are called deep within type inference and static type instantiation where Result propagation cannot easily be bubbled up without a larger architectural shift in the compiler driver.

Action Items
  • Refactor coerce_type and lower_type in generator.rs to safely return Result.
  • Propagate these errors correctly through callers that currently expect a raw Type.
  • Eliminate the remaining compiler panics during MLIR AST lowering in generator.rs.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/codegen/generator.rs by reading coerce_type and lower_type, then trace their callers through type inference and static type instantiation. The issue notes that Result propagation currently causes more than 100 type mismatches, so map that call chain before changing signatures. Done means these functions propagate LowerError and compiler panics during MLIR AST lowering are eliminated.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.