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/wasm/test/fixtures/deps/lib-c/src/lib.nr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mod module;
pub mod module;
2 changes: 1 addition & 1 deletion compiler/wasm/test/fixtures/deps/lib-c/src/module.nr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mod foo;
pub mod foo;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
struct MyStruct {
pub(crate) struct MyStruct {
inner: Field
}
15 changes: 4 additions & 11 deletions test_programs/compile_failure/dep_submodule_overlap/stderr.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
warning: MyStruct is private and not visible from the current module
┌─ src/main.nr:4:17
4 │ use crate::lib::MyStruct;
│ -------- MyStruct is private

warning: struct `MyStruct` is never constructed
┌─ src/lib.nr:1:8
┌─ src/lib.nr:1:19
1 │ struct MyStruct {
│ -------- struct is never constructed
1 │ pub(crate) struct MyStruct {
-------- struct is never constructed

error: Duplicate definitions of import with name lib found
Expand Down Expand Up @@ -39,4 +32,4 @@ error: Could not resolve 'is_struct_zero' in path
│ --------------

Aborting due to 3 previous errors
Aborting due to 3 previous errors
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
trait MyTrait {
pub(crate) trait MyTrait {
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
struct MyStruct {
pub(crate) struct MyStruct {
}
Original file line number Diff line number Diff line change
@@ -1,50 +1,8 @@
warning: MyTrait is private and not visible from the current module
┌─ src/module3.nr:1:21
1 │ use crate::module1::MyTrait;
│ ------- MyTrait is private

warning: MyStruct is private and not visible from the current module
┌─ src/module3.nr:2:21
2 │ use crate::module2::MyStruct;
│ -------- MyStruct is private

warning: MyTrait is private and not visible from the current module
┌─ src/module3.nr:6:22
6 │ impl crate::module1::MyTrait for crate::module2::MyStruct { }
│ ------- MyTrait is private

warning: MyStruct is private and not visible from the current module
┌─ src/module3.nr:6:50
6 │ impl crate::module1::MyTrait for crate::module2::MyStruct { }
│ -------- MyStruct is private

warning: MyStruct is private and not visible from the current module
┌─ src/module3.nr:6:50
6 │ impl crate::module1::MyTrait for crate::module2::MyStruct { }
│ -------- MyStruct is private

warning: MyStruct is private and not visible from the current module
┌─ src/module3.nr:6:50
6 │ impl crate::module1::MyTrait for crate::module2::MyStruct { }
│ -------- MyStruct is private

warning: struct `MyStruct` is never constructed
┌─ src/module2.nr:1:8
┌─ src/module2.nr:1:19
1 │ struct MyStruct {
│ -------- struct is never constructed
1 │ pub(crate) struct MyStruct {
-------- struct is never constructed

error: Impl for type `MyStruct` overlaps with existing impl
Expand All @@ -56,4 +14,4 @@ error: Impl for type `MyStruct` overlaps with existing impl
│ ------------------------ Overlapping impl

Aborting due to 1 previous error
Aborting due to 1 previous error
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
trait MyTrait {
pub(crate) trait MyTrait {
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
struct MyStruct {
pub(crate) struct MyStruct {
}
Original file line number Diff line number Diff line change
@@ -1,50 +1,8 @@
warning: MyTrait is private and not visible from the current module
┌─ src/module3.nr:1:21
1 │ use crate::module1::MyTrait;
│ ------- MyTrait is private

warning: MyStruct is private and not visible from the current module
┌─ src/module3.nr:2:21
2 │ use crate::module2::MyStruct;
│ -------- MyStruct is private

warning: MyTrait is private and not visible from the current module
┌─ src/module4.nr:3:22
3 │ impl crate::module1::MyTrait for crate::module2::MyStruct { }
│ ------- MyTrait is private

warning: MyStruct is private and not visible from the current module
┌─ src/module4.nr:3:50
3 │ impl crate::module1::MyTrait for crate::module2::MyStruct { }
│ -------- MyStruct is private

warning: MyStruct is private and not visible from the current module
┌─ src/module4.nr:3:50
3 │ impl crate::module1::MyTrait for crate::module2::MyStruct { }
│ -------- MyStruct is private

warning: MyStruct is private and not visible from the current module
┌─ src/module4.nr:3:50
3 │ impl crate::module1::MyTrait for crate::module2::MyStruct { }
│ -------- MyStruct is private

warning: struct `MyStruct` is never constructed
┌─ src/module2.nr:1:8
┌─ src/module2.nr:1:19
1 │ struct MyStruct {
│ -------- struct is never constructed
1 │ pub(crate) struct MyStruct {
-------- struct is never constructed

error: Impl for type `MyStruct` overlaps with existing impl
Expand All @@ -59,4 +17,4 @@ error: Impl for type `MyStruct` overlaps with existing impl
│ ------- Previous impl defined here

Aborting due to 1 previous error
Aborting due to 1 previous error
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
trait MyTrait {
pub(crate) trait MyTrait {
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ error: Orphaned trait implementation
│ ---------------- Either the type or the trait must be from the same crate as the trait implementation

Aborting due to 1 previous error
Aborting due to 1 previous error
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ where
}
}

BoundedVec { storage: array, len }
BoundedVec::from_parts_unchecked(array, len)
}

global TX_SIZE: u32 = 5;
Expand Down
3 changes: 2 additions & 1 deletion test_programs/execution_success/bench_2_to_17/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ type = "bin"
authors = [""]
compiler_version = ">=0.33.0"

[dependencies]
[dependencies]
poseidon = { git = "https://github.com/noir-lang/poseidon", tag = "v0.1.0" }
4 changes: 1 addition & 3 deletions test_programs/execution_success/bench_2_to_17/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use std::hash::poseidon2;

global len: u32 = 2450 * 2;
fn main(x: Field) {
let ped_input = [x; len];
let mut val = poseidon2::Poseidon2::hash(ped_input, len);
let mut val = poseidon::poseidon2::Poseidon2::hash(ped_input, len);
assert(val != 0);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ impl Builder {
}

fn swap_items<T, let N: u32>(vec: &mut BoundedVec<T, N>, from_index: u32, to_index: u32) {
let tmp = vec.storage[from_index];
vec.storage[from_index] = vec.storage[to_index];
vec.storage[to_index] = tmp;
let tmp = vec.get_unchecked(from_index);
vec.set_unchecked(from_index, vec.get_unchecked(to_index));
vec.set_unchecked(to_index, tmp);
}

unconstrained fn main() {
let mut builder = Builder { note_hashes: BoundedVec::new(), nullifiers: BoundedVec::new() };

builder.append_note_hashes_with_logs(2);
builder.nullifiers.storage[1] = 27;
builder.nullifiers.set_unchecked(1, 27);
// Get ordered items before shuffling.
let note_hashes = builder.note_hashes.storage;
let note_hashes = builder.note_hashes.storage();
let original_first_note_hash = note_hashes[0];
// Shuffle.
swap_items(&mut builder.note_hashes, 1, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ type = "bin"
authors = [""]
compiler_version = ">=0.27.0"

[dependencies]
[dependencies]
poseidon = { git = "https://github.com/noir-lang/poseidon", tag = "v0.1.0" }
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use std::hash::poseidon2::Poseidon2;

global NUM_HASHES: u32 = 2;
global HASH_LENGTH: u32 = 10;

#[fold]
pub fn poseidon_hash<let N: u32>(inputs: [Field; N]) -> Field {
Poseidon2::hash(inputs, inputs.len())
poseidon::poseidon2::Poseidon2::hash(inputs, inputs.len())
}

fn main(
Expand Down
7 changes: 3 additions & 4 deletions test_programs/execution_success/global_consts/src/foo.nr
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
mod bar;
pub(crate) mod bar;

global N: u32 = 5;
global MAGIC_NUMBER: u32 = 3;
global TYPE_INFERRED: u32 = 42;
pub(crate) global MAGIC_NUMBER: u32 = 3;
pub(crate) global TYPE_INFERRED: u32 = 42;

pub fn from_foo(x: [Field; bar::N]) {
for i in 0..bar::N {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
global N: u32 = 5;
pub(crate) global N: u32 = 5;

pub fn from_bar(x: Field) -> Field {
x * N as Field
Expand Down
7 changes: 1 addition & 6 deletions test_programs/execution_success/global_consts/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,7 @@ fn arrays_neq(a: [Field; M], b: [Field; M]) {
}

mod my_submodule {
global N: u32 = 10;
global L: Field = 50;

fn my_bool_or(x: u1, y: u1) {
assert(x | y == 1);
}
pub(crate) global N: u32 = 10;

pub fn my_helper() -> Field {
let N: u32 = 15; // Like in Rust, local variables override globals
Expand Down
3 changes: 2 additions & 1 deletion test_programs/execution_success/hashmap/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ name = "hashmap"
type = "bin"
authors = [""]

[dependencies]
[dependencies]
poseidon = { git = "https://github.com/noir-lang/poseidon", tag = "v0.1.0" }
2 changes: 1 addition & 1 deletion test_programs/execution_success/hashmap/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
mod utils;

use poseidon::poseidon2::Poseidon2Hasher;
use std::collections::map::HashMap;
use std::hash::BuildHasherDefault;
use std::hash::poseidon2::Poseidon2Hasher;

use utils::cut;

Expand Down
2 changes: 1 addition & 1 deletion test_programs/execution_success/modules_more/src/foo.nr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod bar;
pub(crate) mod bar;

fn hello(x: Field) -> Field {
x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ type = "bin"
authors = [""]
compiler_version = ">=0.28.0"

[dependencies]
[dependencies]
poseidon = { git = "https://github.com/noir-lang/poseidon", tag = "v0.1.0" }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::hash::poseidon2::Poseidon2;
use poseidon::poseidon2::Poseidon2;

global NUM_HASHES: u32 = 2;
global HASH_LENGTH: u32 = 10;
Expand Down
16 changes: 8 additions & 8 deletions test_programs/execution_success/regression_3889/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
mod Foo {
struct NewType {
a: Field,
pub(crate) struct NewType {
pub(crate) a: Field,
}
}

mod Bar {
use crate::Foo::NewType;
use crate::Foo::NewType as BarStruct;
pub(crate) use crate::Foo::NewType;
pub(crate) use crate::Foo::NewType as BarStruct;
}

mod Baz {
struct Works {
a: Field,
pub(crate) struct Works {
pub(crate) a: Field,
}
use crate::Bar::BarStruct;
use crate::Bar::NewType;
pub(crate) use crate::Bar::BarStruct;
pub(crate) use crate::Bar::NewType;
}

fn main(works: Baz::Works, fails: Baz::BarStruct, also_fails: Bar::NewType) -> pub Field {
Expand Down
1 change: 1 addition & 0 deletions test_programs/execution_success/regression_5615/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ authors = [""]
compiler_version = ">=0.32.0"

[dependencies]
poseidon = { git = "https://github.com/noir-lang/poseidon", tag = "v0.1.0" }
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use poseidon::poseidon2::Poseidon2Hasher;
use std::collections::umap::UHashMap;
use std::hash::BuildHasherDefault;
use std::hash::poseidon2::Poseidon2Hasher;

unconstrained fn main() {
comptime {
Expand Down
Loading
Loading