mirror of
https://github.com/Comfy-Org/ComfyUI.git
synced 2026-08-26 02:42:36 +08:00
DynamicSlot: forbid AnyType inside list/MultiType when
Grouping AnyType with concrete types conflates the known-type case with the unresolvable-wildcard case under one branch and muddies slotType. AnyType must stand alone as when=io.AnyType so the two states stay distinct in both dispatch and the serialized schema. Amp-Thread-ID: https://ampcode.com/threads/T-019e8568-f382-743d-a97f-0de3ff29d501 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -69,6 +69,19 @@ def test_option_when_list_with_non_comfytype_rejected():
|
||||
io.DynamicSlot.Option(when=[io.Image, "MASK"], inputs=[])
|
||||
|
||||
|
||||
def test_option_when_list_with_anytype_rejected():
|
||||
"""AnyType must stand alone — it represents the unresolvable-wildcard
|
||||
state, not a concrete type that can share a branch with concrete types."""
|
||||
with pytest.raises(ValueError, match="AnyType cannot be grouped"):
|
||||
io.DynamicSlot.Option(when=[io.Image, io.AnyType], inputs=[])
|
||||
|
||||
|
||||
def test_option_when_multitype_with_anytype_rejected():
|
||||
mt = io.MultiType.Input("x", types=[io.Image, io.AnyType])
|
||||
with pytest.raises(ValueError, match="AnyType cannot be grouped"):
|
||||
io.DynamicSlot.Option(when=mt, inputs=[])
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# DynamicSlot.Input construction and serialization
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user