diff --git a/python/src/matching.py b/python/src/matching.py index 84ec92e..606e2db 100644 --- a/python/src/matching.py +++ b/python/src/matching.py @@ -37,6 +37,10 @@ def world(self): return "world" +class NotDecomposable: + pass + + if __name__ == "__main__": dc = DataClass(name="name", value=3) @@ -68,3 +72,16 @@ def world(self): match nested: case Nested(item=DataClass(value=val, name=nam)): print(val, nam) + + nd = NotDecomposable() + + match nd: + case NotDecomposable(): + print("Still matches.") + + try: + _ = nd.__match_args__ + + raise ValueError("Unreachable.") + except AttributeError: + pass