Skip to content

refactor: derive const type from ConstValueId#9542

Closed
lisenokdonbassenok wants to merge 2 commits intostarkware-libs:mainfrom
lisenokdonbassenok:refactor/lowering-const-type-from-value
Closed

refactor: derive const type from ConstValueId#9542
lisenokdonbassenok wants to merge 2 commits intostarkware-libs:mainfrom
lisenokdonbassenok:refactor/lowering-const-type-from-value

Conversation

@lisenokdonbassenok
Copy link
Contributor

Summary

This change makes the Const generator derive the variable type directly from ConstValueId::ty(ctx.db)
and removes the redundant ty field. All call sites of generators::Const in lowering are updated to
stop passing a type explicitly and rely on the type embedded in the const value.


Type of change

  • New feature

Why is this change needed?

Previously the lowering Const generator duplicated type information: it stored both a ConstValueId and an explicit semantic::TypeId. This opened the door for potential divergence between the value's actual type and the manually passed type.


@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orizi made 1 comment.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @lisenokdonbassenok and @TomerStarkware).


a discussion (no related file):
not sure it is actually better, as it adds an additional call, where in all cases the type was already available.
@TomerStarkware ?

@orizi
Copy link
Collaborator

orizi commented Feb 4, 2026

Closing.

@orizi orizi closed this Feb 4, 2026
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.

3 participants