forked from noir-lang/noir
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(traits): added checks for duplicated trait associated items (typ…
…es, consts, functions) (noir-lang#2927)
- Loading branch information
Showing
24 changed files
with
202 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "dup_trait_items_1" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = "0.15.0" | ||
|
||
[dependencies] |
Empty file.
7 changes: 7 additions & 0 deletions
7
tooling/nargo_cli/tests/compile_failure/dup_trait_items_1/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
trait MyTrait { | ||
fn SomeFunc(); | ||
fn SomeFunc(); | ||
} | ||
|
||
fn main() { | ||
} |
7 changes: 7 additions & 0 deletions
7
tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "dup_trait_items_2" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = "0.15.0" | ||
|
||
[dependencies] |
Empty file.
7 changes: 7 additions & 0 deletions
7
tooling/nargo_cli/tests/compile_failure/dup_trait_items_2/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
trait MyTrait { | ||
let SomeConst: u32; | ||
let SomeConst: Field; | ||
} | ||
|
||
fn main() { | ||
} |
7 changes: 7 additions & 0 deletions
7
tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "dup_trait_items_3" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = "0.15.0" | ||
|
||
[dependencies] |
Empty file.
7 changes: 7 additions & 0 deletions
7
tooling/nargo_cli/tests/compile_failure/dup_trait_items_3/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
trait MyTrait { | ||
type SomeType; | ||
type SomeType; | ||
} | ||
|
||
fn main() { | ||
} |
7 changes: 7 additions & 0 deletions
7
tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "dup_trait_items_4" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = "0.15.0" | ||
|
||
[dependencies] |
Empty file.
7 changes: 7 additions & 0 deletions
7
tooling/nargo_cli/tests/compile_failure/dup_trait_items_4/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
trait MyTrait { | ||
let MyItem: u32; | ||
fn MyItem(); | ||
} | ||
|
||
fn main() { | ||
} |
7 changes: 7 additions & 0 deletions
7
tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "dup_trait_items_5" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = "0.15.0" | ||
|
||
[dependencies] |
Empty file.
7 changes: 7 additions & 0 deletions
7
tooling/nargo_cli/tests/compile_failure/dup_trait_items_5/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
trait MyTrait { | ||
fn MyItem(); | ||
let MyItem: u32; | ||
} | ||
|
||
fn main() { | ||
} |
7 changes: 7 additions & 0 deletions
7
tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "dup_trait_items_6" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = "0.15.0" | ||
|
||
[dependencies] |
Empty file.
15 changes: 15 additions & 0 deletions
15
tooling/nargo_cli/tests/compile_failure/dup_trait_items_6/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
trait MyTrait { | ||
fn SomeFunc() { }; | ||
fn SomeFunc() { }; | ||
} | ||
|
||
struct MyStruct { | ||
} | ||
|
||
impl MyTrait for MyStruct { | ||
fn SomeFunc() { | ||
} | ||
} | ||
|
||
fn main() { | ||
} |
7 changes: 7 additions & 0 deletions
7
tooling/nargo_cli/tests/execution_success/trait_allowed_item_name_matches/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "trait_allowed_item_name_matches" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = "0.15.0" | ||
|
||
[dependencies] |
Empty file.
26 changes: 26 additions & 0 deletions
26
tooling/nargo_cli/tests/execution_success/trait_allowed_item_name_matches/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
trait Trait1 { | ||
// types and consts with the same name are allowed | ||
type Tralala; | ||
let Tralala: u32; | ||
} | ||
|
||
trait Trait2 { | ||
// consts and types with the same name are allowed | ||
let Tralala: u32; | ||
type Tralala; | ||
} | ||
|
||
trait Trait3 { | ||
// types and functions with the same name are allowed | ||
type Tralala; | ||
fn Tralala(); | ||
} | ||
|
||
trait Trait4 { | ||
// functions and types with the same name are allowed | ||
fn Tralala(); | ||
type Tralala; | ||
} | ||
|
||
fn main() { | ||
} |