@@ -115,33 +115,28 @@ def g(x: int): ...
115115) # type: ignore # E: Unused "type: ignore" comment
116116
117117[case testPEP570ArgTypesMissing]
118- # flags: --python-version 3.8 -- disallow-untyped-defs
118+ # flags: --disallow-untyped-defs
119119def f(arg, /) -> None: ... # E: Function is missing a type annotation for one or more arguments
120120
121121[case testPEP570ArgTypesBadDefault]
122- # flags: --python-version 3.8
123122def f(arg: int = "ERROR", /) -> None: ... # E: Incompatible default for argument "arg" (default has type "str", argument has type "int")
124123
125124[case testPEP570ArgTypesDefault]
126- # flags: --python-version 3.8
127125def f(arg: int = 0, /) -> None:
128126 reveal_type(arg) # N: Revealed type is "builtins.int"
129127
130128[case testPEP570ArgTypesRequired]
131- # flags: --python-version 3.8
132129def f(arg: int, /) -> None:
133130 reveal_type(arg) # N: Revealed type is "builtins.int"
134131
135132[case testPEP570Required]
136- # flags: --python-version 3.8
137133def f(arg: int, /) -> None: ... # N: "f" defined here
138134f(1)
139135f("ERROR") # E: Argument 1 to "f" has incompatible type "str"; expected "int"
140136f(arg=1) # E: Unexpected keyword argument "arg" for "f"
141137f(arg="ERROR") # E: Unexpected keyword argument "arg" for "f"
142138
143139[case testPEP570Default]
144- # flags: --python-version 3.8
145140def f(arg: int = 0, /) -> None: ... # N: "f" defined here
146141f()
147142f(1)
@@ -150,7 +145,7 @@ f(arg=1) # E: Unexpected keyword argument "arg" for "f"
150145f(arg="ERROR") # E: Unexpected keyword argument "arg" for "f"
151146
152147[case testPEP570Calls]
153- # flags: --python-version 3.8 -- no-strict-optional
148+ # flags: --no-strict-optional
154149from typing import Any, Dict
155150def f(p, /, p_or_kw, *, kw) -> None: ... # N: "f" defined here
156151d = None # type: Dict[Any, Any]
@@ -163,49 +158,42 @@ f(**d) # E: Missing positional argument "p_or_kw" in call to "f"
163158[builtins fixtures/dict.pyi]
164159
165160[case testPEP570Signatures1]
166- # flags: --python-version 3.8
167161def f(p1: bytes, p2: float, /, p_or_kw: int, *, kw: str) -> None:
168162 reveal_type(p1) # N: Revealed type is "builtins.bytes"
169163 reveal_type(p2) # N: Revealed type is "builtins.float"
170164 reveal_type(p_or_kw) # N: Revealed type is "builtins.int"
171165 reveal_type(kw) # N: Revealed type is "builtins.str"
172166
173167[case testPEP570Signatures2]
174- # flags: --python-version 3.8
175168def f(p1: bytes, p2: float = 0.0, /, p_or_kw: int = 0, *, kw: str) -> None:
176169 reveal_type(p1) # N: Revealed type is "builtins.bytes"
177170 reveal_type(p2) # N: Revealed type is "builtins.float"
178171 reveal_type(p_or_kw) # N: Revealed type is "builtins.int"
179172 reveal_type(kw) # N: Revealed type is "builtins.str"
180173
181174[case testPEP570Signatures3]
182- # flags: --python-version 3.8
183175def f(p1: bytes, p2: float = 0.0, /, *, kw: int) -> None:
184176 reveal_type(p1) # N: Revealed type is "builtins.bytes"
185177 reveal_type(p2) # N: Revealed type is "builtins.float"
186178 reveal_type(kw) # N: Revealed type is "builtins.int"
187179
188180[case testPEP570Signatures4]
189- # flags: --python-version 3.8
190181def f(p1: bytes, p2: int = 0, /) -> None:
191182 reveal_type(p1) # N: Revealed type is "builtins.bytes"
192183 reveal_type(p2) # N: Revealed type is "builtins.int"
193184
194185[case testPEP570Signatures5]
195- # flags: --python-version 3.8
196186def f(p1: bytes, p2: float, /, p_or_kw: int) -> None:
197187 reveal_type(p1) # N: Revealed type is "builtins.bytes"
198188 reveal_type(p2) # N: Revealed type is "builtins.float"
199189 reveal_type(p_or_kw) # N: Revealed type is "builtins.int"
200190
201191[case testPEP570Signatures6]
202- # flags: --python-version 3.8
203192def f(p1: bytes, p2: float, /) -> None:
204193 reveal_type(p1) # N: Revealed type is "builtins.bytes"
205194 reveal_type(p2) # N: Revealed type is "builtins.float"
206195
207196[case testPEP570Unannotated]
208- # flags: --python-version 3.8
209197def f(arg, /): ... # N: "f" defined here
210198g = lambda arg, /: arg
211199def h(arg=0, /): ... # N: "h" defined here
@@ -223,7 +211,6 @@ h(arg=0) # E: Unexpected keyword argument "arg" for "h"
223211i(arg=0) # E: Unexpected keyword argument "arg"
224212
225213[case testWalrus]
226- # flags: --python-version 3.8
227214from typing import NamedTuple, Optional, List
228215from typing_extensions import Final
229216
@@ -399,7 +386,6 @@ reveal_type(z2) # E: Name "z2" is not defined # N: Revealed type is "Any"
399386[builtins fixtures/isinstancelist.pyi]
400387
401388[case testWalrusConditionalTypeBinder]
402- # flags: --python-version 3.8
403389from typing import Tuple, Union
404390from typing_extensions import Literal
405391
@@ -427,7 +413,6 @@ else:
427413[builtins fixtures/list.pyi]
428414
429415[case testWalrusConditionalTypeCheck]
430- # flags: --python-version 3.8
431416from typing import Optional
432417
433418maybe_str: Optional[str]
@@ -443,7 +428,6 @@ reveal_type(maybe_str) # N: Revealed type is "Union[builtins.str, None]"
443428[builtins fixtures/bool.pyi]
444429
445430[case testWalrusConditionalTypeCheck2]
446- # flags: --python-version 3.8
447431from typing import Optional
448432
449433maybe_str: Optional[str]
@@ -459,7 +443,6 @@ reveal_type(maybe_str) # N: Revealed type is "Union[builtins.str, None]"
459443[builtins fixtures/bool.pyi]
460444
461445[case testWalrusPartialTypes]
462- # flags: --python-version 3.8
463446from typing import List
464447
465448def check_partial_list() -> None:
@@ -476,7 +459,7 @@ def check_partial_list() -> None:
476459[builtins fixtures/list.pyi]
477460
478461[case testWalrusAssignmentAndConditionScopeForLiteral]
479- # flags: --warn-unreachable --python-version 3.8
462+ # flags: --warn-unreachable
480463
481464if (x := 0):
482465 reveal_type(x) # E: Statement is unreachable
@@ -486,7 +469,7 @@ else:
486469reveal_type(x) # N: Revealed type is "builtins.int"
487470
488471[case testWalrusAssignmentAndConditionScopeForProperty]
489- # flags: --warn-unreachable --python-version 3.8
472+ # flags: --warn-unreachable
490473
491474from typing_extensions import Literal
492475
@@ -514,7 +497,7 @@ reveal_type(y) # N: Revealed type is "Literal[False]"
514497[builtins fixtures/property.pyi]
515498
516499[case testWalrusAssignmentAndConditionScopeForFunction]
517- # flags: --warn-unreachable --python-version 3.8
500+ # flags: --warn-unreachable
518501
519502from typing_extensions import Literal
520503
@@ -547,7 +530,6 @@ reveal_type(z) # N: Revealed type is "Literal[False]"
547530[builtins fixtures/tuple.pyi]
548531
549532[case testWalrusExpr]
550- # flags: --python-version 3.8
551533def func() -> None:
552534 foo = Foo()
553535 if x := foo.x:
@@ -558,7 +540,6 @@ class Foo:
558540 self.x = 123
559541
560542[case testWalrusTypeGuard]
561- # flags: --python-version 3.8
562543from typing_extensions import TypeGuard
563544def is_float(a: object) -> TypeGuard[float]: pass
564545def main(a: object) -> None:
@@ -568,22 +549,19 @@ def main(a: object) -> None:
568549[builtins fixtures/tuple.pyi]
569550
570551[case testWalrusRedefined]
571- # flags: --python-version 3.8
572552def foo() -> None:
573553 x = 0
574554 [x := x + y for y in [1, 2, 3]]
575555[builtins fixtures/dict.pyi]
576556
577557[case testWalrusUsedBeforeDef]
578- # flags: --python-version 3.8
579558class C:
580559 def f(self, c: 'C') -> None: pass
581560
582561(x := C()).f(y) # E: Cannot determine type of "y" # E: Name "y" is used before definition
583562(y := C()).f(y)
584563
585564[case testOverloadWithPositionalOnlySelf]
586- # flags: --python-version 3.8
587565from typing import overload, Optional
588566
589567class Foo:
@@ -608,7 +586,6 @@ class Bar:
608586[builtins fixtures/bool.pyi]
609587
610588[case testOverloadPositionalOnlyErrorMessage]
611- # flags: --python-version 3.8
612589from typing import overload
613590
614591@overload
@@ -619,13 +596,12 @@ def foo(a): ...
619596
620597foo(a=1)
621598[out]
622- main:10 : error: No overload variant of "foo" matches argument type "int"
623- main:10 : note: Possible overload variants:
624- main:10 : note: def foo(int, /) -> Any
625- main:10 : note: def foo(a: str) -> Any
599+ main:9 : error: No overload variant of "foo" matches argument type "int"
600+ main:9 : note: Possible overload variants:
601+ main:9 : note: def foo(int, /) -> Any
602+ main:9 : note: def foo(a: str) -> Any
626603
627604[case testOverloadPositionalOnlyErrorMessageAllTypes]
628- # flags: --python-version 3.8
629605from typing import overload
630606
631607@overload
@@ -636,13 +612,12 @@ def foo(a, b, *, c): ...
636612
637613foo(a=1)
638614[out]
639- main:10 : error: No overload variant of "foo" matches argument type "int"
640- main:10 : note: Possible overload variants:
641- main:10 : note: def foo(int, /, b: int, *, c: int) -> Any
642- main:10 : note: def foo(a: str, b: int, *, c: int) -> Any
615+ main:9 : error: No overload variant of "foo" matches argument type "int"
616+ main:9 : note: Possible overload variants:
617+ main:9 : note: def foo(int, /, b: int, *, c: int) -> Any
618+ main:9 : note: def foo(a: str, b: int, *, c: int) -> Any
643619
644620[case testOverloadPositionalOnlyErrorMessageMultiplePosArgs]
645- # flags: --python-version 3.8
646621from typing import overload
647622
648623@overload
@@ -653,13 +628,12 @@ def foo(a, b, c, d): ...
653628
654629foo(a=1)
655630[out]
656- main:10 : error: No overload variant of "foo" matches argument type "int"
657- main:10 : note: Possible overload variants:
658- main:10 : note: def foo(int, int, int, /, d: str) -> Any
659- main:10 : note: def foo(a: str, b: int, c: int, d: str) -> Any
631+ main:9 : error: No overload variant of "foo" matches argument type "int"
632+ main:9 : note: Possible overload variants:
633+ main:9 : note: def foo(int, int, int, /, d: str) -> Any
634+ main:9 : note: def foo(a: str, b: int, c: int, d: str) -> Any
660635
661636[case testOverloadPositionalOnlyErrorMessageMethod]
662- # flags: --python-version 3.8
663637from typing import overload
664638
665639class Some:
@@ -673,14 +647,13 @@ class Some:
673647
674648Some().foo(a=1)
675649[out]
676- main:13 : error: No overload variant of "foo" of "Some" matches argument type "int"
677- main:13 : note: Possible overload variants:
678- main:13 : note: def foo(self, int, /) -> Any
679- main:13 : note: def foo(self, float, /) -> Any
680- main:13 : note: def foo(self, a: str) -> Any
650+ main:12 : error: No overload variant of "foo" of "Some" matches argument type "int"
651+ main:12 : note: Possible overload variants:
652+ main:12 : note: def foo(self, int, /) -> Any
653+ main:12 : note: def foo(self, float, /) -> Any
654+ main:12 : note: def foo(self, a: str) -> Any
681655
682656[case testOverloadPositionalOnlyErrorMessageClassMethod]
683- # flags: --python-version 3.8
684657from typing import overload
685658
686659class Some:
@@ -699,14 +672,13 @@ class Some:
699672Some.foo(a=1)
700673[builtins fixtures/classmethod.pyi]
701674[out]
702- main:17 : error: No overload variant of "foo" of "Some" matches argument type "int"
703- main:17 : note: Possible overload variants:
704- main:17 : note: def foo(cls, int, /) -> Any
705- main:17 : note: def foo(cls, float, /) -> Any
706- main:17 : note: def foo(cls, a: str) -> Any
675+ main:16 : error: No overload variant of "foo" of "Some" matches argument type "int"
676+ main:16 : note: Possible overload variants:
677+ main:16 : note: def foo(cls, int, /) -> Any
678+ main:16 : note: def foo(cls, float, /) -> Any
679+ main:16 : note: def foo(cls, a: str) -> Any
707680
708681[case testUnpackWithDuplicateNamePositionalOnly]
709- # flags: --python-version 3.8
710682from typing_extensions import Unpack, TypedDict
711683
712684class Person(TypedDict):
@@ -717,7 +689,7 @@ def foo(name: str, /, **kwargs: Unpack[Person]) -> None: # Allowed
717689[builtins fixtures/dict.pyi]
718690
719691[case testPossiblyUndefinedWithAssignmentExpr]
720- # flags: --python-version 3.8 -- enable-error-code possibly-undefined
692+ # flags: --enable-error-code possibly-undefined
721693def f1() -> None:
722694 d = {0: 1}
723695 if int():
@@ -744,7 +716,6 @@ main:9: note: Revealed type is "builtins.int"
744716main:9: note: Revealed type is "builtins.str"
745717
746718[case testTypeGuardWithPositionalOnlyArg]
747- # flags: --python-version 3.8
748719from typing_extensions import TypeGuard
749720
750721def typeguard(x: object, /) -> TypeGuard[int]:
@@ -755,10 +726,9 @@ if typeguard(n):
755726 reveal_type(n)
756727[builtins fixtures/tuple.pyi]
757728[out]
758- main:9 : note: Revealed type is "builtins.int"
729+ main:8 : note: Revealed type is "builtins.int"
759730
760731[case testTypeGuardKeywordFollowingWalrus]
761- # flags: --python-version 3.8
762732from typing import cast
763733from typing_extensions import TypeGuard
764734
@@ -769,7 +739,7 @@ if typeguard(x=(n := cast(object, "hi"))):
769739 reveal_type(n)
770740[builtins fixtures/tuple.pyi]
771741[out]
772- main:9 : note: Revealed type is "builtins.int"
742+ main:8 : note: Revealed type is "builtins.int"
773743
774744[case testNoCrashOnAssignmentExprClass]
775745class C:
0 commit comments