Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/elaborator/trait_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl Elaborator<'_> {

if overrides.len() > 1 {
self.push_err(DefCollectorErrorKind::Duplicate {
typ: DuplicateType::TraitAssociatedFunction,
typ: DuplicateType::TraitAssociatedItem,
first_def: overrides[0].2.name_ident().clone(),
second_def: overrides[1].2.name_ident().clone(),
});
Expand Down
6 changes: 3 additions & 3 deletions compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@
}
Err((first_def, second_def)) => {
let error = DefCollectorErrorKind::Duplicate {
typ: DuplicateType::TraitAssociatedFunction,
typ: DuplicateType::TraitAssociatedItem,
first_def,
second_def,
};
Expand All @@ -618,7 +618,7 @@
.declare_global(name.clone(), ItemVisibility::Public, global_id)
{
let error = DefCollectorErrorKind::Duplicate {
typ: DuplicateType::TraitAssociatedConst,
typ: DuplicateType::TraitAssociatedItem,
first_def,
second_def,
};
Expand Down Expand Up @@ -646,7 +646,7 @@
)
{
let error = DefCollectorErrorKind::Duplicate {
typ: DuplicateType::TraitAssociatedType,
typ: DuplicateType::TraitAssociatedItem,
first_def,
second_def,
};
Expand Down Expand Up @@ -936,7 +936,7 @@
// if it's an inline module, or the first char of a the file if it's an external module.
// - `location` will always point to the token "foo" in `mod foo` regardless of whether
// it's inline or external.
// Eventually the location put in `ModuleData` is used for codelenses about `contract`s,

Check warning on line 939 in compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (codelenses)
// so we keep using `location` so that it continues to work as usual.
let location = Location::new(mod_name.span(), mod_location.file);
let new_module = ModuleData::new(
Expand Down
8 changes: 2 additions & 6 deletions compiler/noirc_frontend/src/hir/def_collector/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ pub enum DuplicateType {
Import,
Trait,
TraitImplementation,
TraitAssociatedType,
TraitAssociatedConst,
TraitAssociatedFunction,
TraitAssociatedItem,
StructField,
EnumVariant,
}
Expand Down Expand Up @@ -145,9 +143,7 @@ impl fmt::Display for DuplicateType {
DuplicateType::Trait => write!(f, "trait definition"),
DuplicateType::TraitImplementation => write!(f, "trait implementation"),
DuplicateType::Import => write!(f, "import"),
DuplicateType::TraitAssociatedType => write!(f, "trait associated type"),
DuplicateType::TraitAssociatedConst => write!(f, "trait associated constant"),
DuplicateType::TraitAssociatedFunction => write!(f, "trait associated function"),
DuplicateType::TraitAssociatedItem => write!(f, "trait associated item"),
DuplicateType::StructField => write!(f, "struct field"),
DuplicateType::EnumVariant => write!(f, "enum variant"),
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/noirc_frontend/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@

let chars = line.chars().collect::<Vec<_>>();
let first_caret = chars.iter().position(|c| *c == char).unwrap();
let last_caret = chars.iter().rposition(|c| *c == char).unwrap();

Check warning on line 287 in compiler/noirc_frontend/src/tests.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (rposition)
let start = byte - last_line_length;
let span = Span::from((start + first_caret - 1) as u32..(start + last_caret) as u32);
let error = line.trim().trim_start_matches(char).trim().to_string();
Expand Down Expand Up @@ -453,13 +453,13 @@
impl Default2 for Foo {
// Duplicate trait methods should not compile
fn default(x: Field, y: Field) -> Field {
~~~~~~~ First trait associated function found here
~~~~~~~ First trait associated item found here
y + 2 * x
}
// Duplicate trait methods should not compile
fn default(x: Field, y: Field) -> Field {
^^^^^^^ Duplicate definitions of trait associated function with name default found
~~~~~~~ Second trait associated function found here
^^^^^^^ Duplicate definitions of trait associated item with name default found
~~~~~~~ Second trait associated item found here
x + 2 * y
}
}
Expand Down Expand Up @@ -3190,7 +3190,7 @@
// wouldn't panic due to infinite recursion, but the errors asserted here
// come from the compilation checks, which does static analysis to catch the
// problem before it even has a chance to cause a panic.
let srcs = vec![

Check warning on line 3193 in compiler/noirc_frontend/src/tests.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (srcs)
r#"
fn main() {
^^^^ function `main` cannot return without recursing
Expand Down Expand Up @@ -3272,7 +3272,7 @@
"#,
];

for (index, src) in srcs.into_iter().enumerate() {

Check warning on line 3275 in compiler/noirc_frontend/src/tests.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (srcs)
check_errors(src, Some(&format!("{}_{index}", function_path!())));
}
}
Expand All @@ -3280,7 +3280,7 @@
#[named]
#[test]
fn unconditional_recursion_pass() {
let srcs = vec![

Check warning on line 3283 in compiler/noirc_frontend/src/tests.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (srcs)
r#"
fn main() {
if false { main(); }
Expand Down Expand Up @@ -3322,7 +3322,7 @@
"#,
];

for (index, src) in srcs.into_iter().enumerate() {

Check warning on line 3325 in compiler/noirc_frontend/src/tests.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (srcs)
assert_no_errors(src, &format!("{}_{index}", function_path!()));
}
}
Expand Down Expand Up @@ -4362,12 +4362,12 @@
let mut array = [1, 2, 3];
borrow(&array);
^^^^^^ This requires the unstable feature 'ownership' which is not enabled
~~~~~~ Pass -Zownership to nargo to enable this feature at your own risk.

Check warning on line 4365 in compiler/noirc_frontend/src/tests.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Zownership)
}

fn borrow(_array: &[Field; 3]) {}
^^^^^^^^^^^ This requires the unstable feature 'ownership' which is not enabled
~~~~~~~~~~~ Pass -Zownership to nargo to enable this feature at your own risk.

Check warning on line 4370 in compiler/noirc_frontend/src/tests.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Zownership)
"#;
check_errors!(src);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "trait_associated_items_clash"
type = "bin"
authors = [""]

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pub trait Foo {
let N: u32;

fn N() {}
}

fn main() {}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading