Fix the Imaginate node from crashing (#1512)

* Allow generic node input for type inference

* Make imaginate resolution picking depend on the image resolution instead of the transform

* Remove dead code

* Fix console spam after crash

* Fix crash when disconnecting Imaginate node input

* Update Imaginate tool tooltip

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
This commit is contained in:
Keavon Chambers
2023-12-12 22:39:33 -08:00
committed by GitHub
parent f58aa73edc
commit 83af879a7c
15 changed files with 98 additions and 133 deletions

View File

@@ -623,9 +623,6 @@ impl TypingContext {
.get(&node.identifier)
.ok_or(format!("No implementations found for:\n\n{:?}\n\nOther implementations found:\n\n{:?}", node.identifier, self.lookup))?;
if matches!(input, Type::Generic(_)) {
return Err(format!("Generic types are not supported as inputs yet {:?} occurred in {:?}", input, node.identifier));
}
if parameters.iter().any(|p| {
matches!(p,
Type::Fn(_, b) if matches!(b.as_ref(), Type::Generic(_)))
@@ -636,8 +633,9 @@ impl TypingContext {
match (from, to) {
(Type::Concrete(t1), Type::Concrete(t2)) => t1 == t2,
(Type::Fn(a1, b1), Type::Fn(a2, b2)) => covariant(a1, a2) && covariant(b1, b2),
// TODO: relax this requirement when allowing generic types as inputs
(Type::Generic(_), _) => false,
// TODO: Add proper generic counting which is not based on the name
(Type::Generic(_), Type::Generic(_)) => true,
(Type::Generic(_), _) => true,
(_, Type::Generic(_)) => true,
_ => false,
}