Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mypy/nativeparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ def native_parse_type_string(
data = ReadBuffer(ast_bytes)
ret = read_type(state, data)
assert isinstance(ret, ProperType)
if isinstance(ret, RawExpressionType) and expr_string == "None":
return UnboundType("None", line=line, column=column)
return ret


Expand Down
6 changes: 6 additions & 0 deletions test-data/unit/check-newsemanal.test
Original file line number Diff line number Diff line change
Expand Up @@ -2311,6 +2311,12 @@ reveal_type(x.x) # N: Revealed type is "builtins.int"
C = NamedTuple('C', [('x', int)])
[builtins fixtures/tuple.pyi]

[case testNewAnalyzerCastNoneString]
from typing import Any, cast

def f(x: Any) -> None:
return cast("None", x)

[case testNewAnalyzerApplicationForward1]
# flags: --disable-error-code used-before-def
from typing import Generic, TypeVar
Expand Down
Loading