Skip to content

Commit

Permalink
frontend: Start with DoubleEndedIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
dinfuehr committed Feb 15, 2025
1 parent 3d2ae98 commit 2386bcf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dora-frontend/src/traitdefck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,4 +610,18 @@ mod tests {
}
");
}

#[test]
#[ignore]
fn assoc_type_of_super_trait() {
ok("
trait Foo {
type Item;
}
trait Bar: Foo {
fn f(): Self::Item;
}
");
}
}
13 changes: 13 additions & 0 deletions pkgs/std/traits.dora
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ pub trait Iterator {
fn collect[T](): T where T: FromIterator[Self::Item] {
T::fromIter[Self](self)
}

@TraitObjectIgnore
fn rev(): Rev[Self] where Self: DoubleEndedIterator {
Rev[Self](self)
}
}

pub trait DoubleEndedIterator: Iterator {
// fn nextBack(): Option[Self::Item];
}

pub trait IntoIterator {
Expand Down Expand Up @@ -212,6 +221,10 @@ impl[I: Iterator, R] Iterator for Map[I, R] {
}
}

pub class Rev[I: Iterator] {
it: I,
}

pub trait FromIterator[A] {
static fn fromIter[T](iter: T): Self where T: Iterator[Item=A];
}
Expand Down

0 comments on commit 2386bcf

Please sign in to comment.