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

docs: Fix parameter type and return value to match trait signature #7126

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

0xminds
Copy link
Contributor

@0xminds 0xminds commented Jan 21, 2025

I noticed a mismatch in the parameter type and return value compared to the trait signature. I've updated the parameter b: felt252 to t: T and corrected the return value to (T, felt252) to align with the expected trait implementation.

This should resolve the inconsistency.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @0xminds)


adrs/003_simple_trait_system.md line 30 at r1 (raw file):

impl MyImpl<A> for MyTrait<A, felt252> {
  type T = A;
  fn f(a: A, t: T) -> (T, felt252) { ... }

Suggestion:

trait MyTrait<A, B> {
  type T;
  fn f(a: A, t: Self::T) -> (Self::T, B);
}

This item introduces an "interface", with function signatures and associated types that need to be
defined by the implementations.
Note that there is no Self or a type this trait is for. It is stand alone.

Impl top level item

impl MyImpl<A> for MyTrait<A, felt252> {
  type T = A;
  fn f(a: A, t: A) -> (A, felt252) { ... }

@0xminds 0xminds requested a review from orizi January 22, 2025 07:01
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @0xminds)


adrs/003_simple_trait_system.md line 28 at r2 (raw file):

### Impl top level item

impl MyTrait<A, felt252> for MyImpl {

now it is just plain wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants