@@ -707,6 +707,7 @@ y: Foo[Foo] # E: Literal[...] must have at least one parameter
707
707
708
708
NotAType = 3
709
709
def f() -> NotAType['also' + 'not' + 'a' + 'type']: ... # E: Variable "__main__.NotAType" is not valid as a type \
710
+ # N: See https://mypy.readthedocs.io/en/latest/common_issues.html#variables-vs-type-aliases \
710
711
# E: Invalid type comment or annotation
711
712
712
713
# Note: this makes us re-inspect the type (e.g. via '_patch_indirect_dependencies'
@@ -907,10 +908,12 @@ d2t = 3j
907
908
908
909
a2: a2t
909
910
reveal_type(a2) # N: Revealed type is 'Any'
910
- b2: b2t # E: Variable "__main__.b2t" is not valid as a type
911
+ b2: b2t # E: Variable "__main__.b2t" is not valid as a type \
912
+ # N: See https://mypy.readthedocs.io/en/latest/common_issues.html#variables-vs-type-aliases
911
913
c2: c2t
912
914
reveal_type(c2) # N: Revealed type is 'Any'
913
- d2: d2t # E: Variable "__main__.d2t" is not valid as a type
915
+ d2: d2t # E: Variable "__main__.d2t" is not valid as a type \
916
+ # N: See https://mypy.readthedocs.io/en/latest/common_issues.html#variables-vs-type-aliases
914
917
[builtins fixtures/complex_tuple.pyi]
915
918
[out]
916
919
@@ -949,8 +952,10 @@ c: [1, 2, 3] # E: Bracketed expression "[...]" is not valid a
949
952
from typing_extensions import Literal
950
953
at = Literal[{"a": 1, "b": 2}] # E: Invalid type alias: expression is not a valid type
951
954
bt = {"a": 1, "b": 2}
952
- a: at # E: Variable "__main__.at" is not valid as a type
953
- b: bt # E: Variable "__main__.bt" is not valid as a type
955
+ a: at # E: Variable "__main__.at" is not valid as a type \
956
+ # N: See https://mypy.readthedocs.io/en/latest/common_issues.html#variables-vs-type-aliases
957
+ b: bt # E: Variable "__main__.bt" is not valid as a type \
958
+ # N: See https://mypy.readthedocs.io/en/latest/common_issues.html#variables-vs-type-aliases
954
959
[builtins fixtures/dict.pyi]
955
960
[out]
956
961
@@ -959,8 +964,10 @@ b: bt # E: Variable "__main__.bt" is not valid as a ty
959
964
from typing_extensions import Literal
960
965
at = Literal[{1, 2, 3}] # E: Invalid type alias: expression is not a valid type
961
966
bt = {1, 2, 3}
962
- a: at # E: Variable "__main__.at" is not valid as a type
963
- b: bt # E: Variable "__main__.bt" is not valid as a type
967
+ a: at # E: Variable "__main__.at" is not valid as a type \
968
+ # N: See https://mypy.readthedocs.io/en/latest/common_issues.html#variables-vs-type-aliases
969
+ b: bt # E: Variable "__main__.bt" is not valid as a type \
970
+ # N: See https://mypy.readthedocs.io/en/latest/common_issues.html#variables-vs-type-aliases
964
971
[builtins fixtures/set.pyi]
965
972
[out]
966
973
@@ -2868,13 +2875,17 @@ d: Literal[3]
2868
2875
# "3" wherever it's used and get the same behavior -- so maybe we do need to support
2869
2876
# at least case "b" for consistency?
2870
2877
a_wrap: Literal[4, a] # E: Parameter 2 of Literal[...] is invalid \
2871
- # E: Variable "__main__.a" is not valid as a type
2878
+ # E: Variable "__main__.a" is not valid as a type \
2879
+ # N: See https://mypy.readthedocs.io/en/latest/common_issues.html#variables-vs-type-aliases
2872
2880
b_wrap: Literal[4, b] # E: Parameter 2 of Literal[...] is invalid \
2873
- # E: Variable "__main__.b" is not valid as a type
2881
+ # E: Variable "__main__.b" is not valid as a type \
2882
+ # N: See https://mypy.readthedocs.io/en/latest/common_issues.html#variables-vs-type-aliases
2874
2883
c_wrap: Literal[4, c] # E: Parameter 2 of Literal[...] is invalid \
2875
- # E: Variable "__main__.c" is not valid as a type
2884
+ # E: Variable "__main__.c" is not valid as a type \
2885
+ # N: See https://mypy.readthedocs.io/en/latest/common_issues.html#variables-vs-type-aliases
2876
2886
d_wrap: Literal[4, d] # E: Parameter 2 of Literal[...] is invalid \
2877
- # E: Variable "__main__.d" is not valid as a type
2887
+ # E: Variable "__main__.d" is not valid as a type \
2888
+ # N: See https://mypy.readthedocs.io/en/latest/common_issues.html#variables-vs-type-aliases
2878
2889
[builtins fixtures/tuple.pyi]
2879
2890
[out]
2880
2891
0 commit comments