@@ -542,7 +542,9 @@ pub enum GraphErrorType {
542542 UnexpectedGenerics { index : usize , inputs : Vec < Type > } ,
543543 NoImplementations ,
544544 NoConstructor ,
545- InvalidImplementations { inputs : String , error_inputs : Vec < Vec < ( usize , ( Type , Type ) ) > > } ,
545+ // The first vec represents a list of correct NodeIOTypes
546+ // The second vec represents what the input index and what it expects
547+ InvalidImplementations { inputs : String , error_inputs : Vec < Vec < ( usize , Type ) > > } ,
546548 MultipleImplementations { inputs : String , valid : Vec < NodeIOTypes > } ,
547549}
548550impl Debug for GraphErrorType {
@@ -554,31 +556,26 @@ impl Debug for GraphErrorType {
554556 GraphErrorType :: NoImplementations => write ! ( f, "No implementations found" ) ,
555557 GraphErrorType :: NoConstructor => write ! ( f, "No construct found for node" ) ,
556558 GraphErrorType :: InvalidImplementations { inputs, error_inputs } => {
557- let format_error = |( index, ( found, expected) ) : & ( usize , ( Type , Type ) ) | {
558- let index = index + 1 ;
559- format ! (
560- "\
561- • Input {index}:\n \
562- …found: {found}\n \
563- …expected: {expected}\
564- "
565- )
566- } ;
567- let format_error_list = |errors : & Vec < ( usize , ( Type , Type ) ) > | errors. iter ( ) . map ( format_error) . collect :: < Vec < _ > > ( ) . join ( "\n " ) ;
568- let mut errors = error_inputs. iter ( ) . map ( format_error_list) . collect :: < Vec < _ > > ( ) ;
569- errors. sort ( ) ;
570- let errors = errors. join ( "\n " ) ;
571- let incompatibility = if errors. chars ( ) . filter ( |& c| c == '•' ) . count ( ) == 1 {
572- "This input type is incompatible:"
573- } else {
574- "These input types are incompatible:"
575- } ;
559+ let mut solutions = error_inputs
560+ . iter ( )
561+ . enumerate ( )
562+ . map ( |( solution_index, expected_inputs) | {
563+ format ! (
564+ "• Solution {}{}" ,
565+ solution_index + 1 ,
566+ expected_inputs
567+ . map( |( index, expected_type) | format!( "Input {} expected: {}\n " , index + 1 , expected_type) )
568+ . collect:: <String >( )
569+ )
570+ } )
571+ . collect :: < Vec < _ > > ( )
572+ . join ( "\n " ) ;
576573
577574 write ! (
578575 f,
579576 "\
580- {incompatibility} \n \
581- {errors }\n \
577+ Invalid input solutions: \n \
578+ {solutions }\n \
582579 \n \
583580 The node is currently receiving all of the following input types:\n \
584581 {inputs}\n \
@@ -766,10 +763,7 @@ impl TypingContext {
766763 . zip ( [ & node_io. call_argument ] . into_iter ( ) . chain ( & node_io. inputs ) . cloned ( ) )
767764 . enumerate ( )
768765 . filter ( |( _, ( p1, p2) ) | !valid_type ( p1, p2) )
769- . map ( |( index, ty) | {
770- let i = node. original_location . inputs ( index) . min_by_key ( |s| s. node . len ( ) ) . map ( |s| s. index ) . unwrap_or ( index) ;
771- ( i, ty)
772- } )
766+ . map ( |( index, ( _, expected) ) | ( index, expected) )
773767 . collect :: < Vec < _ > > ( ) ;
774768 if current_errors. len ( ) < best_errors {
775769 best_errors = current_errors. len ( ) ;
0 commit comments