-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix where clause issue in items generated from attributes (#5673)
# Description ## Problem\* Resolves #5671 ## Summary\* The issue was that we were adding trait constraints to the methods themselves in `dc_mod` but this code isn't run for items generated from attributes which only go through the elaborator. I've just moved this code to the elaborator instead. ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information
Showing
4 changed files
with
32 additions
and
2 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
7 changes: 7 additions & 0 deletions
7
test_programs/compile_success_empty/regression_5671/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 = "regression_5671" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = ">=0.32.0" | ||
|
||
[dependencies] |
20 changes: 20 additions & 0 deletions
20
test_programs/compile_success_empty/regression_5671/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,20 @@ | ||
#[foo] | ||
struct MyOtherStruct<A, B> { | ||
field1: A, | ||
field2: B, | ||
} | ||
|
||
comptime fn foo(_s: StructDefinition) -> Quoted { | ||
quote { | ||
impl<A, B> Eq for MyOtherStruct<A, B> where A: Eq, B: Eq { | ||
fn eq(self, other: Self) -> bool { | ||
(self.field1 == other.field1) & (self.field2 == other.field2) | ||
} | ||
} | ||
} | ||
} | ||
|
||
fn main() { | ||
let x = MyOtherStruct { field1: 1, field2: 2 }; | ||
assert_eq(x, x); | ||
} |