@@ -143,7 +143,7 @@ ee_var = everything
143
143
ee_var = everywhere
144
144
145
145
ee_var = specific_1 # The difference between Callable[..., blah] and one with a *args: Any, **kwargs: Any is that the ... goes loosely both ways.
146
- ee_def = specific_1 # E: Incompatible types in assignment (expression has type Callable[[int, str], None], variable has type Callable[[StarArg (Any), KwArg(Any)], None])
146
+ ee_def = specific_1 # E: Incompatible types in assignment (expression has type Callable[[int, str], None], variable has type Callable[[VarArg (Any), KwArg(Any)], None])
147
147
148
148
[builtins fixtures/dict.pyi]
149
149
@@ -1409,7 +1409,7 @@ def a(f: F):
1409
1409
1410
1410
[case testCallableParsingFromExpr]
1411
1411
from typing import Callable
1412
- from mypy_extensions import Arg, StarArg , KwArg
1412
+ from mypy_extensions import Arg, VarArg , KwArg
1413
1413
1414
1414
def WrongArg(x, y): return y
1415
1415
# Note that for this test, the 'Value of type "int" is not indexable' errors are silly,
@@ -1418,10 +1418,10 @@ def WrongArg(x, y): return y
1418
1418
# that looks like a function call.
1419
1419
F = Callable[[WrongArg(int, 'x')], int] # E: Unknown argument constructor WrongArg
1420
1420
G = Callable[[Arg(1, 'x')], int] # E: Invalid type alias # E: Value of type "int" is not indexable
1421
- H = Callable[[StarArg (int, 'x')], int] # E: StarArg should not have a specified name
1422
- I = Callable[[StarArg (int)], int] # ok
1423
- J = Callable[[StarArg (), KwArg()], int] # ok
1424
- K = Callable[[StarArg (), int], int] # E: Required positional args may not appear after default, named or star args
1421
+ H = Callable[[VarArg (int, 'x')], int] # E: VarArg should not have a specified name
1422
+ I = Callable[[VarArg (int)], int] # ok
1423
+ J = Callable[[VarArg (), KwArg()], int] # ok
1424
+ K = Callable[[VarArg (), int], int] # E: Required positional args may not appear after default, named or star args
1425
1425
L = Callable[[Arg(name='x', typ=int)], int] # ok
1426
1426
# I have commented out the following test because I don't know how to expect the "defined here" note part of the error.
1427
1427
# M = Callable[[Arg(gnome='x', typ=int)], int] # Invalid type alias, Unexpected keyword argument "gnome" for "Arg"
@@ -1431,16 +1431,16 @@ N = Callable[[Arg(name=None, typ=int)], int] # ok
1431
1431
1432
1432
[case testCallableParsing]
1433
1433
from typing import Callable
1434
- from mypy_extensions import Arg, StarArg , KwArg
1434
+ from mypy_extensions import Arg, VarArg , KwArg
1435
1435
1436
1436
def WrongArg(x, y): return y
1437
1437
1438
1438
# This test only shows parse-time errors
1439
1439
def a(f: Callable[[WrongArg(int, 'x')], int]): pass # typeanal-time error
1440
1440
def b(f: Callable[[Arg(1, 'x')], int]): pass # E: invalid type comment or annotation
1441
- def c(f: Callable[[StarArg (int, 'x')], int]): pass # typeanal-time error
1442
- def d(f: Callable[[StarArg (int)], int]): pass # ok
1443
- def e(f: Callable[[StarArg (), KwArg()], int]): pass # ok
1441
+ def c(f: Callable[[VarArg (int, 'x')], int]): pass # typeanal-time error
1442
+ def d(f: Callable[[VarArg (int)], int]): pass # ok
1443
+ def e(f: Callable[[VarArg (), KwArg()], int]): pass # ok
1444
1444
def g(f: Callable[[Arg(name='x', typ=int)], int]): pass # ok
1445
1445
def h(f: Callable[[Arg(gnome='x', typ=int)], int]): pass # E: Unexpected argument "gnome" for argument constructor
1446
1446
def i(f: Callable[[Arg(name=None, typ=int)], int]): pass # ok
@@ -1461,19 +1461,19 @@ from mypy_extensions import Arg
1461
1461
def b(f: Callable[[Arg(1, 'x')], int]): pass # E: invalid type comment or annotation
1462
1462
[builtins fixtures/dict.pyi]
1463
1463
1464
- [case testCallableFastParseTooManyStarArg ]
1464
+ [case testCallableFastParseTooManyVarArg ]
1465
1465
# flags: --fast-parser
1466
1466
from typing import Callable
1467
- from mypy_extensions import StarArg
1468
- def c(f: Callable[[StarArg (int, 'x')], int]): pass # E: StarArg should not have a specified name
1467
+ from mypy_extensions import VarArg
1468
+ def c(f: Callable[[VarArg (int, 'x')], int]): pass # E: VarArg should not have a specified name
1469
1469
[builtins fixtures/dict.pyi]
1470
1470
1471
1471
[case testCallableFastParseGood]
1472
1472
# flags: --fast-parser
1473
1473
from typing import Callable
1474
- from mypy_extensions import StarArg , Arg, KwArg
1475
- def d(f: Callable[[StarArg (int)], int]): pass # ok
1476
- def e(f: Callable[[StarArg (), KwArg()], int]): pass # ok
1474
+ from mypy_extensions import VarArg , Arg, KwArg
1475
+ def d(f: Callable[[VarArg (int)], int]): pass # ok
1476
+ def e(f: Callable[[VarArg (), KwArg()], int]): pass # ok
1477
1477
def g(f: Callable[[Arg(name='x', typ=int)], int]): pass # ok
1478
1478
def i(f: Callable[[Arg(name=None, typ=int)], int]): pass # ok
1479
1479
[builtins fixtures/dict.pyi]
@@ -1487,10 +1487,10 @@ def h(f: Callable[[Arg(gnome='x', typ=int)], int]): pass # E: Unexpected argumen
1487
1487
1488
1488
[case testCallableKindsOrdering]
1489
1489
from typing import Callable
1490
- from mypy_extensions import Arg, StarArg , KwArg, DefaultArg, NamedArg
1490
+ from mypy_extensions import Arg, VarArg , KwArg, DefaultArg, NamedArg
1491
1491
1492
- def f(f: Callable[[StarArg (), int], int]): pass # E: Required positional args may not appear after default, named or star args
1493
- def g(f: Callable[[StarArg (), StarArg ()], int]): pass # E: Star args may not appear after named or star args
1492
+ def f(f: Callable[[VarArg (), int], int]): pass # E: Required positional args may not appear after default, named or star args
1493
+ def g(f: Callable[[VarArg (), VarArg ()], int]): pass # E: Star args may not appear after named or star args
1494
1494
def h(f: Callable[[KwArg(), KwArg()], int]): pass # E: You may only have one **kwargs argument
1495
1495
def i(f: Callable[[DefaultArg(), int], int]): pass # E: Required positional args may not appear after default, named or star args
1496
1496
def j(f: Callable[[NamedArg(int, 'x'), DefaultArg(int, 'y')], int]): pass # E: Positional default args may not appear after named or star args
@@ -1499,7 +1499,7 @@ def j(f: Callable[[NamedArg(int, 'x'), DefaultArg(int, 'y')], int]): pass # E: P
1499
1499
1500
1500
[case testCallableDuplicateNames]
1501
1501
from typing import Callable
1502
- from mypy_extensions import Arg, StarArg , KwArg, DefaultArg
1502
+ from mypy_extensions import Arg, VarArg , KwArg, DefaultArg
1503
1503
1504
1504
def f(f: Callable[[Arg(int, 'x'), int, Arg(int, 'x')], int]): pass # E: duplicate argument 'x' in callable type
1505
1505
0 commit comments