diff --git a/crates/ty_python_semantic/resources/mdtest/call/union.md b/crates/ty_python_semantic/resources/mdtest/call/union.md index b14cc427a51ac..ddb56cb51a38b 100644 --- a/crates/ty_python_semantic/resources/mdtest/call/union.md +++ b/crates/ty_python_semantic/resources/mdtest/call/union.md @@ -299,16 +299,16 @@ class RecursiveAttr2: self.i = 0 def update(self): - self.i = (self.i + 1) % 9 + self.i = (self.i + 1) % 4 -reveal_type(RecursiveAttr2().i) # revealed: Unknown | Literal[0, 1, 2, 3, 4, 5, 6, 7, 8] +reveal_type(RecursiveAttr2().i) # revealed: Unknown | Literal[0, 1, 2, 3] class RecursiveAttr3: def __init__(self): self.i = 0 def update(self): - self.i = (self.i + 1) % 10 + self.i = (self.i + 1) % 5 # Going beyond the MAX_RECURSIVE_UNION_LITERALS limit: reveal_type(RecursiveAttr3().i) # revealed: Unknown | int diff --git a/crates/ty_python_semantic/src/types/builder.rs b/crates/ty_python_semantic/src/types/builder.rs index 233b75277f409..c779ab0c1f95d 100644 --- a/crates/ty_python_semantic/src/types/builder.rs +++ b/crates/ty_python_semantic/src/types/builder.rs @@ -256,7 +256,7 @@ impl RecursivelyDefined { /// If the value ​​is defined recursively, widening is performed from fewer literal elements, /// resulting in faster convergence of the fixed-point iteration. -const MAX_RECURSIVE_UNION_LITERALS: usize = 10; +const MAX_RECURSIVE_UNION_LITERALS: usize = 5; /// If the value ​​is defined non-recursively, the fixed-point iteration will converge in one go, /// so in principle we can have as many literal elements as we want, /// but to avoid unintended huge computational loads, we limit it to 256.