Skip to content

Commit 37be49f

Browse files
authored
chore!: convert TraitMethodNotInScope to error (#7427)
1 parent 1b4dc1d commit 37be49f

File tree

11 files changed

+22
-10
lines changed

11 files changed

+22
-10
lines changed

compiler/noirc_frontend/src/hir/resolution/import.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl<'a> From<&'a PathResolutionError> for CustomDiagnostic {
112112
CustomDiagnostic::simple_error(error.to_string(), String::new(), ident.location())
113113
}
114114
PathResolutionError::TraitMethodNotInScope { ident, .. } => {
115-
CustomDiagnostic::simple_warning(error.to_string(), String::new(), ident.location())
115+
CustomDiagnostic::simple_error(error.to_string(), String::new(), ident.location())
116116
}
117117
PathResolutionError::UnresolvedWithPossibleTraitsToImport { ident, traits } => {
118118
let mut traits = vecmap(traits, |trait_name| format!("`{}`", trait_name));

test_programs/execution_success/derive/src/main.nr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::hash::Hash;
1+
use std::hash::{Hash, Hasher};
22

33
#[derive_via(derive_do_nothing)]
44
trait DoNothing {

test_programs/execution_success/embedded_curve_ops/src/main.nr

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::ops::Add;
2+
13
fn main(priv_key: Field, pub_x: pub Field, pub_y: pub Field) {
24
let g1_y = 17631683881184975370165255887551781615748388533673675138860;
35
let g1 = std::embedded_curve_ops::EmbeddedCurvePoint { x: 1, y: g1_y, is_infinite: false };

test_programs/execution_success/inline_decompose_hint_brillig_call/src/main.nr

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use std::embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, fixed_base_scalar_mul};
1+
use std::{
2+
embedded_curve_ops::{EmbeddedCurvePoint, EmbeddedCurveScalar, fixed_base_scalar_mul},
3+
ops::Add,
4+
};
25

36
fn main() -> pub Field {
47
let pre_address = 0x23d95e303879a5d0bbef78ecbc335e559da37431f6dcd11da54ed375c2846813;

test_programs/execution_success/traits_in_crates_1/crate1/src/lib.nr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
trait MyTrait {
1+
pub trait MyTrait {
22
fn Add10(&mut self);
33
}
44

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
struct MyStruct {
2-
Q: Field,
1+
pub struct MyStruct {
2+
pub Q: Field,
33
}

test_programs/execution_success/traits_in_crates_1/src/main.nr

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use crate1::MyTrait;
2+
13
fn main(x: Field, y: pub Field) {
24
let mut V = crate2::MyStruct { Q: x };
35
V.Add10();
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
trait MyTrait {
1+
pub trait MyTrait {
22
fn Add10(&mut self);
33
}

test_programs/execution_success/traits_in_crates_2/crate2/src/lib.nr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
struct MyStruct {
2-
Q: Field,
1+
pub struct MyStruct {
2+
pub Q: Field,
33
}
44

55
impl crate1::MyTrait for MyStruct {

test_programs/execution_success/traits_in_crates_2/src/main.nr

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use crate1::MyTrait;
2+
13
fn main(x: Field, y: pub Field) {
24
let mut V = crate2::MyStruct { Q: x };
35
V.Add10();

tooling/nargo_cli/tests/stdlib-props.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ fn fuzz_poseidon_equivalence() {
177177
// Noir has hashes up to length 16, but the reference library won't work with more than 12.
178178
for len in 1..light_poseidon::MAX_X5_LEN {
179179
let source = format!(
180-
"fn main(input: [Field; {len}]) -> pub Field {{
180+
"
181+
use std::hash::{{Hash, Hasher}};
182+
183+
fn main(input: [Field; {len}]) -> pub Field {{
181184
let h1 = std::hash::poseidon::bn254::hash_{len}(input);
182185
let h2 = {{
183186
let mut hasher = std::hash::poseidon::PoseidonHasher::default();

0 commit comments

Comments
 (0)