@@ -82,27 +82,29 @@ def match_types(sinktype, src, iid, inputobj, linkMerge, valueFrom):
8282 else :
8383 raise WorkflowException (u"Unrecognized linkMerge enum '%s'" % linkMerge )
8484 return True
85- elif valueFrom is not None or are_same_type (src .parameter ["type" ], sinktype ) or sinktype == "Any" :
85+ elif valueFrom is not None or can_assign_src_to_sink (src .parameter ["type" ], sinktype ) or sinktype == "Any" :
8686 # simply assign the value from state to input
8787 inputobj [iid ] = copy .deepcopy (src .value )
8888 return True
8989 return False
9090
91- def are_same_type (src , sink ): # type: (Any, Any) -> bool
91+ def can_assign_src_to_sink (src , sink ): # type: (Any, Any) -> bool
9292 """Check for identical type specifications, ignoring extra keys like inputBinding.
9393 """
9494 if isinstance (src , dict ) and isinstance (sink , dict ):
9595 if src ["type" ] == "array" and sink ["type" ] == "array" :
96- if 'null' in sink ["items" ]:
97- return are_same_type ([src ["items" ]], [it for it in sink ["items" ] if it != 'null' ])
98- return are_same_type (src ["items" ], sink ["items" ])
99- elif src ["type" ] == sink ["type" ]:
100- return True
101- else :
102- return False
96+ return can_assign_src_to_sink (src ["items" ], sink ["items" ])
97+ elif isinstance (src , list ):
98+ for t in src :
99+ if can_assign_src_to_sink (t , sink ):
100+ return True
101+ elif isinstance (sink , list ):
102+ for t in sink :
103+ if can_assign_src_to_sink (src , t ):
104+ return True
103105 else :
104106 return src == sink
105-
107+ return False
106108
107109def object_from_state (state , parms , frag_only , supportsMultipleInput , sourceField ):
108110 # type: (Dict[unicode, WorkflowStateItem], List[Dict[unicode, Any]], bool, bool, unicode) -> Dict[unicode, Any]
0 commit comments