Fix the Into nodes, which were broken but unused except in GPU nodes (#2480)

* Prototype document network level into node insertion

* Fix generic type resolution

* Cleanup

* Remove network nesting
This commit is contained in:
Dennis Kobert 2025-03-27 10:11:11 +01:00 committed by GitHub
parent 92132919d1
commit 41288d7642
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 100 additions and 47 deletions

View file

@ -293,7 +293,7 @@ impl Type {
}
}
pub fn nested_type(self) -> Type {
pub fn nested_type(&self) -> &Type {
match self {
Self::Generic(_) => self,
Self::Concrete(_) => self,
@ -301,6 +301,18 @@ impl Type {
Self::Future(output) => output.nested_type(),
}
}
pub fn replace_nested(&mut self, f: impl Fn(&Type) -> Option<Type>) -> Option<Type> {
if let Some(replacement) = f(self) {
return Some(std::mem::replace(self, replacement));
}
match self {
Self::Generic(_) => None,
Self::Concrete(_) => None,
Self::Fn(_, output) => output.replace_nested(f),
Self::Future(output) => output.replace_nested(f),
}
}
}
fn format_type(ty: &str) -> String {