Skip to content

Commit d2ed9a0

Browse files
committed
relaxed type-checking to allow parent->child matching when connecting lazy-fields
1 parent 0b8e3e5 commit d2ed9a0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pydra/utils/typing.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,12 @@ def expand_and_check(tp, pattern: ty.Union[type, tuple]):
348348
return check_tuple(tp_args, pattern_args)
349349
return check_sequence(tp_args, pattern_args)
350350

351-
def check_basic(tp, pattern):
352-
if not self.is_subclass(tp, pattern):
353-
self.check_coercible(tp, pattern)
351+
def check_basic(tp, target):
352+
# Note that we are deliberately more permissive than typical type-checking
353+
# here, allowing parents of the target type as well as children,
354+
# to avoid users having to cast from loosely typed tasks to strict ones
355+
if not self.is_subclass(tp, target) and not self.is_subclass(target, tp):
356+
self.check_coercible(tp, target)
354357

355358
def check_union(tp, pattern_args):
356359
if get_origin(tp) is ty.Union:

0 commit comments

Comments
 (0)