-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: overload
==
to call Eq
trait implementation
- Loading branch information
1 parent
b8c7078
commit 1ffe9f3
Showing
5 changed files
with
42 additions
and
98 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
5 changes: 5 additions & 0 deletions
5
test_programs/execution_success/trait_equality_overload/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,5 @@ | ||
[package] | ||
name = "trait_equality_overload" | ||
type = "bin" | ||
authors = [""] | ||
[dependencies] |
2 changes: 2 additions & 0 deletions
2
test_programs/execution_success/trait_equality_overload/Prover.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,2 @@ | ||
[x] | ||
inner = "42" |
16 changes: 16 additions & 0 deletions
16
test_programs/execution_success/trait_equality_overload/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,16 @@ | ||
use dep::std::ops::Eq; | ||
|
||
struct FieldWrapper { | ||
inner: Field | ||
} | ||
|
||
impl Eq for FieldWrapper { | ||
fn eq(self, other: FieldWrapper) -> bool { | ||
self.inner == other.inner | ||
} | ||
} | ||
|
||
fn main(x: FieldWrapper) { | ||
let y = FieldWrapper { inner: 42 }; | ||
assert(x == y); | ||
} |