This repository was archived by the owner on Feb 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
support generics in traits #68
Copy link
Copy link
Open
Labels
enhancementimproving existing functionalityimproving existing functionalitygood first issuegood for newcomersgood for newcomerstyperanything related to the typechecker and the typesystemanything related to the typechecker and the typesystem
Milestone
Description
Consider:
@pub trait Iterator {
fun next(): Option[Int32]; // this should be made generic
}
Ideally we would have:
@pub trait Iterator[T] {
fun next(): Option[T];
}
Which compiles, but a trait impls like ...
impl Iterator[Int32] for NoInt32Iterator {
fun next(): Option[Int32] = None[Int32];
}
... fails compilation with:
return types `Option[Int32]` and `Option[T]` do not match
Feels like we forget specializing the return type.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementimproving existing functionalityimproving existing functionalitygood first issuegood for newcomersgood for newcomerstyperanything related to the typechecker and the typesystemanything related to the typechecker and the typesystem