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

chore!: convert TraitMethodNotInScope to error #7427

Merged
merged 11 commits into from
Mar 7, 2025
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/resolution/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl<'a> From<&'a PathResolutionError> for CustomDiagnostic {
CustomDiagnostic::simple_error(error.to_string(), String::new(), ident.location())
}
PathResolutionError::TraitMethodNotInScope { ident, .. } => {
CustomDiagnostic::simple_warning(error.to_string(), String::new(), ident.location())
CustomDiagnostic::simple_error(error.to_string(), String::new(), ident.location())
}
PathResolutionError::UnresolvedWithPossibleTraitsToImport { ident, traits } => {
let mut traits = vecmap(traits, |trait_name| format!("`{}`", trait_name));
Expand Down
2 changes: 1 addition & 1 deletion test_programs/execution_success/derive/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::hash::Hash;
use std::hash::{Hash, Hasher};

#[derive_via(derive_do_nothing)]
trait DoNothing {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::ops::Add;

fn main(priv_key: Field, pub_x: pub Field, pub_y: pub Field) {
let g1_y = 17631683881184975370165255887551781615748388533673675138860;
let g1 = std::embedded_curve_ops::EmbeddedCurvePoint { x: 1, y: g1_y, is_infinite: false };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use std::embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, fixed_base_scalar_mul};
use std::{
embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, fixed_base_scalar_mul},
ops::Add,
};

fn main() -> pub Field {
let pre_address = 0x23d95e303879a5d0bbef78ecbc335e559da37431f6dcd11da54ed375c2846813;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
trait MyTrait {
pub trait MyTrait {
fn Add10(&mut self);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
struct MyStruct {
Q: Field,
pub struct MyStruct {
pub Q: Field,
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use crate1::MyTrait;

fn main(x: Field, y: pub Field) {
let mut V = crate2::MyStruct { Q: x };
V.Add10();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
trait MyTrait {
pub trait MyTrait {
fn Add10(&mut self);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
struct MyStruct {
Q: Field,
pub struct MyStruct {
pub Q: Field,
}

impl crate1::MyTrait for MyStruct {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use crate1::MyTrait;

fn main(x: Field, y: pub Field) {
let mut V = crate2::MyStruct { Q: x };
V.Add10();
Expand Down
5 changes: 4 additions & 1 deletion tooling/nargo_cli/tests/stdlib-props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ fn fuzz_poseidon_equivalence() {
// Noir has hashes up to length 16, but the reference library won't work with more than 12.
for len in 1..light_poseidon::MAX_X5_LEN {
let source = format!(
"fn main(input: [Field; {len}]) -> pub Field {{
"
use std::hash::{{Hash, Hasher}};

fn main(input: [Field; {len}]) -> pub Field {{
let h1 = std::hash::poseidon::bn254::hash_{len}(input);
let h2 = {{
let mut hasher = std::hash::poseidon::PoseidonHasher::default();
Expand Down
Loading