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

fix: Use annotated type when checking declaration #4966

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
4 changes: 3 additions & 1 deletion compiler/noirc_frontend/src/hir/type_check/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,10 @@ impl<'interner> TypeChecker<'interner> {
if annotated_type.is_unsigned() {
self.lint_overflowing_uint(&rhs_expr, &annotated_type);
}
annotated_type
} else {
expr_type
}
expr_type
}

/// Check if an assignment is overflowing with respect to `annotated_type`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "slice_init_with_complex_type"
type = "bin"
authors = [""]
compiler_version = ">=0.28.0"

[dependencies]
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
struct strct1 {
elem1: Field,
}

fn main() {
let var1: [[i32; 1]] = [[0]];
let var2: [[i32; 1]] = var1;

let var1: [(i32, u8)] = [(1, 2)];
let var2: [(i32, u8)] = var1;

let var3: [strct1] = [strct1 { elem1: 1321351 }];
let var4: [strct1] = var3;

let var1: [i32; 1] = [0];
let var2: [[i32; 1]] = [var1];
}
Loading