You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for ch in x: # E: Iterating over "str" is disallowed # N: This is because --disallow-str-iteration is enabled
2475
-
reveal_type(ch) # N: Revealed type is "builtins.str"
2484
+
reveal_type(ch) # N: Revealed type is "builtins.str | builtins.int"
2485
+
2486
+
T = TypeVar('T', bound=str)
2476
2487
2477
-
def takes_bound[T: str](x: T) -> None:
2488
+
def takes_str_upper_bound(x: T) -> None:
2478
2489
for ch in x: # E: Iterating over "str" is disallowed # N: This is because --disallow-str-iteration is enabled
2479
2490
reveal_type(ch) # N: Revealed type is "builtins.str"
2480
2491
2492
+
reveal_type(reversed(s)) # N: Revealed type is "builtins.reversed[builtins.str]" # E: Argument 1 to "reversed" has incompatible type "str"; expected "Reversible[str]"
2493
+
2494
+
[builtins fixtures/str-iter.pyi]
2495
+
[typing fixtures/typing-str-iter.pyi]
2496
+
2481
2497
[case testIterStrOverload]
2498
+
# flags: --disallow-str-iteration
2482
2499
reveal_type(iter("foo")) # N: Revealed type is "typing.Iterable[builtins.str]"
0 commit comments