@@ -542,6 +542,8 @@ pub enum GraphErrorType {
542542 UnexpectedGenerics { index : usize , inputs : Vec < Type > } ,
543543 NoImplementations ,
544544 NoConstructor ,
545+ // The first vec represents a list of correct NodeIOTypes
546+ // The second vec represents what the input index and what it expects
545547 InvalidImplementations { inputs : String , error_inputs : Vec < Vec < ( usize , ( Type , Type ) ) > > } ,
546548 MultipleImplementations { inputs : String , valid : Vec < NodeIOTypes > } ,
547549}
@@ -756,20 +758,19 @@ impl TypingContext {
756758
757759 match valid_impls. as_slice ( ) {
758760 [ ] => {
761+ let convert_node_index_offset = node. original_location . auto_convert_index . unwrap_or ( 0 ) ;
759762 let mut best_errors = usize:: MAX ;
760763 let mut error_inputs = Vec :: new ( ) ;
761764 for node_io in impls. keys ( ) {
765+ // For errors on convert nodes, add to the input index to it is correct for the node it is connected to
762766 let current_errors = [ call_argument]
763767 . into_iter ( )
764768 . chain ( & inputs)
765769 . cloned ( )
766770 . zip ( [ & node_io. call_argument ] . into_iter ( ) . chain ( & node_io. inputs ) . cloned ( ) )
767771 . enumerate ( )
768772 . 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- } )
773+ . map ( |( index, expected) | ( index - 1 + convert_node_index_offset, expected) )
773774 . collect :: < Vec < _ > > ( ) ;
774775 if current_errors. len ( ) < best_errors {
775776 best_errors = current_errors. len ( ) ;
@@ -783,7 +784,7 @@ impl TypingContext {
783784 . into_iter ( )
784785 . chain ( & inputs)
785786 . enumerate ( )
786- . filter_map ( |( i, t) | if i == 0 { None } else { Some ( format ! ( "• Input {i }: {t}" ) ) } )
787+ . filter_map ( |( i, t) | if i == 0 { None } else { Some ( format ! ( "• Input {}: {t}" , i + convert_node_index_offset ) ) } )
787788 . collect :: < Vec < _ > > ( )
788789 . join ( "\n " ) ;
789790 Err ( vec ! [ GraphError :: new( node, GraphErrorType :: InvalidImplementations { inputs, error_inputs } ) ] )
0 commit comments