Allow unions when inferring annotations

This commit is contained in:
Dave Halter
2026-05-01 16:33:24 +02:00
parent 418598d8c1
commit 01dc123ea1
+3 -3
View File
@@ -32,9 +32,9 @@ def infer_annotation(context, annotation):
Also checks for forward references (strings)
"""
value_set = context.infer_node(annotation)
if len(value_set) != 1:
debug.warning("Inferred typing index %s should lead to 1 object, "
" not %s" % (annotation, value_set))
if len(value_set) == 0:
debug.warning(
"Inferred typing index %s should lead to 1 object, not %s" % (annotation, value_set))
return value_set
inferred_value = list(value_set)[0]