Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Trait Inheritance #3949

Closed
Tracked by #2568
sirasistant opened this issue Jan 4, 2024 · 0 comments · Fixed by #6252
Closed
Tracked by #2568

Support Trait Inheritance #3949

sirasistant opened this issue Jan 4, 2024 · 0 comments · Fixed by #6252
Labels
enhancement New feature or request
Milestone

Comments

@sirasistant
Copy link
Contributor

sirasistant commented Jan 4, 2024

Problem

We'd like to be able to define a trait as a combination of other traits.

Happy Case

The following syntax should compile:

trait Backend: SmartContract + ProofSystemCompiler + Default + Debug {}

Alternatives Considered

It can be worked around by creating a blanket implementation for the trait Backend for all types that implement SmartContract + ProofSystemCompiler + Default + Debug but it's not ideal.

Another workaround is to have each function with a T: Backend bound replaced with the inherited bounds instead: T: SmartContract + ProofSystemCompiler + Default + Debug

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@sirasistant sirasistant added the enhancement New feature or request label Jan 4, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jan 4, 2024
@Savio-Sou Savio-Sou mentioned this issue Jan 8, 2024
46 tasks
@jfecher jfecher changed the title Combining traits Support Trait Inheritance Jan 8, 2024
@kevaundray kevaundray added this to the 1.0 milestone Jan 15, 2024
@asterite asterite mentioned this issue Oct 8, 2024
5 tasks
github-merge-queue bot pushed a commit that referenced this issue Oct 11, 2024
# Description

## Problem

Resolves #3949

## Summary

Still pending documentation.

## Additional Context

I copied part of the documentation from
[here](https://practice.course.rs/generics-traits/advanced-traits.html#supertraits),
I hope it's fine.

## Documentation\*

Check one:
- [ ] No documentation needed.
- [x] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [ ] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.

---------

Co-authored-by: jfecher <[email protected]>
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants