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

Add associated items to impls and traits. #610

Closed
1 of 2 tasks
otrho opened this issue Jan 10, 2022 · 0 comments · Fixed by #5048
Closed
1 of 2 tasks

Add associated items to impls and traits. #610

otrho opened this issue Jan 10, 2022 · 0 comments · Fixed by #5048
Labels
compiler General compiler. Should eventually become more specific as the issue is triaged enhancement New feature or request language feature Core language features visible to end users P: high Should be looked at if there are no critical issues left

Comments

@otrho
Copy link
Contributor

otrho commented Jan 10, 2022

We should be able to add types and consts to trait and impl declarations, as per:

https://doc.rust-lang.org/reference/items/associated-items.html

Useful for:

impl u64 {
    pub const MIN: u64 = 0;
    pub const MAX: u64 = 18446744073709551615;
    pub const BITS: u32 = 64;
}

and obviously:

pub trait Iterator {
    type Item;
    fn next(&mut self) -> Option<Self::Item>;
}
@otrho otrho added enhancement New feature or request compiler General compiler. Should eventually become more specific as the issue is triaged labels Jan 10, 2022
@adlerjohn adlerjohn moved this to Todo in Fuel Network Jan 10, 2022
@mohammadfawaz mohammadfawaz added the language feature Core language features visible to end users label Mar 15, 2022
@mohammadfawaz mohammadfawaz added the P: high Should be looked at if there are no critical issues left label Apr 5, 2022
esdrubal added a commit that referenced this issue Sep 19, 2023
## Description

Implements associated types parsing.

Adds associated types to trait map.

Modifies resolve_symbol to handle associated types.

Support was added for type ascription, methods parameters, method return
types, and function parameters.

It is still missing fully qualified paths, and checking associated types
name conflicts.

It is also missing updating the documentation.

Closes #4487
Closes #610

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: IGI-111 <[email protected]>
@github-project-automation github-project-automation bot moved this from Todo to Done in Fuel Network Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler General compiler. Should eventually become more specific as the issue is triaged enhancement New feature or request language feature Core language features visible to end users P: high Should be looked at if there are no critical issues left
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants