Open
Description
The output of the second increment of this fine-grained incremental mode test case doesn't generate an error, even though nothing relevant has changed:
[case testRefreshNestedNewType]
import a
[file a.py]
from typing import Union, NewType
import b
def f(self) -> None:
X = NewType('X', A)
A = str
[file b.py]
y = 0
[file b.py.2]
y = ''
[out]
Here's the output:
a.py:5: error: Argument 2 to NewType(...) must be subclassable (got A?)
==
The expected output would be identical for both runs.
The output from the first and second runs also does not match for this slightly different test case:
[case testRefreshNestedNewType]
import a
[file a.py]
from typing import Union, NewType
import b
def f(self) -> None:
X = NewType('X', A)
A = Union[int, str]
[file b.py]
y = 0
[file b.py.2]
y = ''
[out]
Here's the output (again expected to be identical):
a.py:5: error: Argument 2 to NewType(...) must be subclassable (got A?)
==
a.py:5: error: Argument 2 to NewType(...) must be subclassable (got "Union[int, str]")
It looks like forward references within NewType declarations behave inconsistently.