Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Make for-loop range be a polymorphic integer instead of just Field in unconstrained functions #1583

Merged
merged 5 commits into from
Jun 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions crates/noirc_frontend/src/hir/type_check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ impl<'interner> TypeChecker<'interner> {
let start_span = self.interner.expr_span(&for_expr.start_range);
let end_span = self.interner.expr_span(&for_expr.end_range);

let mut unify_loop_range = |actual_type, span| {
let mut unify_loop_range = |actual_type: &Type, span: Span| {
let expected_type = if self.is_unconstrained() {
Type::FieldElement(CompTime::new(self.interner))
Type::PolymorphicInteger(
CompTime::new(self.interner),
Shared::new(TypeBinding::Bound(actual_type.clone())),
jfecher marked this conversation as resolved.
Show resolved Hide resolved
)
} else {
Type::comp_time(Some(span))
};
Expand Down