feat: Basic implementation of traits#2368
Conversation
|
@jfecher Have a nice weekend :) |
crates/nargo_cli/tests/compile_failure/trait_wrong_parameters_count/src/main.nr
Show resolved
Hide resolved
crates/nargo_cli/tests/compile_failure/trait_not_exists/Nargo.toml
Outdated
Show resolved
Hide resolved
jfecher
left a comment
There was a problem hiding this comment.
Just a few more small suggestions
crates/nargo_cli/tests/compile_failure/trait_wrong_parameters_count/src/main.nr
Show resolved
Hide resolved
|
Looks like you've got some import errors |
db2be73 to
675708a
Compare
Converted the traits-related tests that are supposed to fail, to the proper format (nargo packages) in the crates/nargo_cli/tests/compile_failure directory. This ensures that the tests are now executed when 'cargo test' is run.
convert to `from_func_return_type` to struct method. Definitely a better approach. Co-authored-by: jfecher <jfecher11@gmail.com>
clean up Co-authored-by: jfecher <jfecher11@gmail.com>
13ed272 to
05b5208
Compare
|
Does this close #527? |
|
@yordanmadzhunkov would you like to take a jab at documenting this PR? #3193 |
|
Sure, we will document traits, but for now I prefer to focus on testing/bug fixing, before documentation. |
* master: chore: update ACIR artifacts (#2503) chore!: Update to `acvm-backend-barretenberg` v0.12.0 (#2377) fix: Bring back accidentally deleted double_verify_proof test. (#2501) chore(aztec_noir): import aztec library if not found yet (#2492) chore(abi)!: Replace struct name with fully qualified struct path (#2374) chore!: Remove keys from preprocessed artifacts (#2283) chore(noir): Release 0.10.5 (#2482) feat: Basic implementation of traits (#2368) fix: Implement constant folding during the mem2reg pass (#2464)
|
@Savio-Sou we're avoiding documenting traits until they're complete. We don't want users to be thinking they're in the language yet. There's also a compiler warning when using them to alert users they're still in development. This PR is just one in a series since traits are a large feature we need to break up into many PRs. |
|
@Savio-Sou I believe @yordanmadzhunkov and his team is currently working on such a list. |
|
@yordanmadzhunkov I'm documenting traits in the Noir docs. Will add you as a reviewer if you don't mind! |
|
@signorecello |
Description
Make the most basic test case for traits execute correctly. Although this review looks big, it's mostly test code.
Next step will be to refactor tests in resolver, so I can add more unit tests and move the errors from Def Collecter to Resolver.
PR Checklist*
cargo fmton default settings.After this PR this noir programs work:
Execution of specialized for the specific type:
Execution of trait provided default implementation
For more examples refer to tests added in this PR