fix(docs): add missing type definitions in impl alias example#9499
Open
forkfury wants to merge 3 commits intostarkware-libs:mainfrom
Open
fix(docs): add missing type definitions in impl alias example#9499forkfury wants to merge 3 commits intostarkware-libs:mainfrom
forkfury wants to merge 3 commits intostarkware-libs:mainfrom
Conversation
orizi
requested changes
Jan 20, 2026
Collaborator
orizi
left a comment
There was a problem hiding this comment.
@orizi made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @forkfury).
docs/reference/src/components/cairo/modules/language_constructs/pages/aliases.adoc line 30 at r1 (raw file):
Examples: [source,cairo] ----
this entire section should just point to the impl-aliases page and not exist at all.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed incomplete impl alias example in
aliases.adocby adding missing trait and impl definitions. The example previously referenced undefined types (Pow,Algebra,I32Algebra), making it confusing for readers who couldn't understand the code without external context.Type of change
Please check one:
Why is this change needed?
The impl alias example in
aliases.adocwas incomplete and misleading. It showed an impl alias referencingAnyAlgebraPow<i32, I32Algebra>, but neither thePowtrait,Algebratrait, norI32Algebraimpl were defined in the example. This made the code snippet non-functional and confusing for readers trying to understand impl aliases, as they couldn't see how the types relate or what the example actually demonstrates.What was the behavior or documentation before?
The example showed:airo
// Pow implementation for any algebra.
impl AnyAlgebraPow<A, impl AlgImpl: Algebra> of Pow { ... }
// Impl alias for Pow of i32.
impl Int32Pow = AnyAlgebraPow<i32, I32Algebra>;This referenced undefined types (
Pow,Algebra,I32Algebra) and used placeholder syntax ({ ... }), making it impossible to understand without looking up other documentation files.What is the behavior or documentation after?
The example now includes complete, self-contained definitions:o
trait Pow {
fn pow(base: T, exp: u32) -> T;
}
impl AnyAlgebraPow<T, impl AlgImpl: Algebra> of Pow {
fn pow(base: T, exp: u32) -> T {
// Implementation details.
base
}
}
trait Algebra {
fn identity() -> T;
}
impl I32Algebra of Algebra {
fn identity() -> i32 {
1
}
}
// Impl alias for Pow of i32.
impl Int32Pow = AnyAlgebraPow<i32, I32Algebra>;Readers can now understand the complete relationship between traits, impls, and impl aliases without needing to reference other documentation.
Related issue or discussion (if any)
Additional context
This aligns the example with the approach used in
impl-aliases.adoc, which provides complete, self-contained examples. The fix ensures consistency across documentation and improves the learning experience for developers new to Cairo's impl alias feature.