-
Notifications
You must be signed in to change notification settings - Fork 115
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
Recusion Limit - Round 2 #306
Conversation
The "chain" of types If there are only 83 instead of 84 types, then everything works, so that seems to be the limit currently.
|
New codegen for #[derive(TS)]
#[ts(export, export_to = "generics/")]
struct Generic<T>
where
T: TS,
{
value: T,
values: Vec<T>,
} looks like this: fn visit_generics(v: &mut impl TypeVisitor) where Self: 'static, {
v.visit::<T>();
<T as TS>::visit_generics(v);
}
fn visit_dependencies(v: &mut impl TypeVisitor) where Self: 'static, {
<T as TS>::visit_generics(v);
<Vec<T> as TS>::visit_generics(v);
v.visit::<T>();
v.visit::<Vec<T>>();
} What previously was a This completely sidesteps the recusion limit problem: There's no complicated type like |
Originally, I thought that having a |
The fn generics() -> impl TypeList where Self: 'static {
struct List;
impl TypeList for List {
fn for_each(&self, v: &mut impl TypeVisitor) {
v.visit::<T>();
T::generics().for_each(v);
}
}
List
} Here, the |
Due to this PR removing trait functions that return |
# Conflicts: # ts-rs/src/lib.rs
Merging this now. Not yet sure if we should publish a 9.0, or wait for the CLI. |
I don't mind publishing a 9.0, especially with the bug mentioned in #317 being fixed in this PR. The CLI can wait untill version 10 |
Goal
Determine when recusion limit errors still happen, reproduce and possibly fix them
Changes
TypeList
, moveTypeVisitor
tolib.rs
dependency_types() -> TypeList
got changed tovisit_dependencies(v: &mut impl TypeVisitor)
generics() -> TypeList
got changed tovisit_generics(v: &mut impl TypeVisitor)
This is again a technically breaking change for anyone interacting with the
TS
trait directly.Checklist