Skip to content

Commit

Permalink
fix: numeric generic doesn't have a default type (#6405)
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite authored Oct 30, 2024
1 parent 321a493 commit 3a073f7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 1 addition & 3 deletions compiler/noirc_frontend/src/hir_def/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,9 @@ impl Kind {
/// during monomorphization.
pub(crate) fn default_type(&self) -> Option<Type> {
match self {
Kind::Any => None,
Kind::IntegerOrField => Some(Type::default_int_or_field_type()),
Kind::Integer => Some(Type::default_int_type()),
Kind::Normal => None,
Kind::Numeric(typ) => Some(*typ.clone()),
Kind::Any | Kind::Normal | Kind::Numeric(..) => None,
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "cannot_deduce_numeric_generic"
type = "bin"
authors = [""]
compiler_version = ">=0.33.0"

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fn foo<let N: u32>() -> u32 {
N
}

fn main() {
let _ = foo();
}

0 comments on commit 3a073f7

Please sign in to comment.