Skip to content
Open
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: 1 addition & 1 deletion conformance/results/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ <h3>Python Type System Conformance Test Results</h3>
<th class="column col2 conformant">Pass</th>
<th class="column col2 conformant">Pass</th>
<th class="column col2 conformant">Pass</th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Attempts to detect some errors even in blocks it determines to be unreachable, including in `if not TYPE_CHECKING` blocks.</p></span></div></th>
<th class="column col2 conformant">Pass</th>
</tr>
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;directives_type_ignore</th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not honor "# type: ignore" comment if comment includes additional text.</p></span></div></th>
Expand Down
8 changes: 1 addition & 7 deletions conformance/results/ty/directives_type_checking.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
conformance_automated = "Fail"
conformant = "Partial"
notes = """
Attempts to detect some errors even in blocks it determines to be unreachable, including in `if not TYPE_CHECKING` blocks.
"""
conformance_automated = "Pass"
errors_diff = """
Line 11: Unexpected errors ['directives_type_checking.py:11:14: error[invalid-assignment] Object of type `Literal[""]` is not assignable to `int`']
"""
output = """
directives_type_checking.py:11:14: error[invalid-assignment] Object of type `Literal[""]` is not assignable to `int`
"""
14 changes: 7 additions & 7 deletions conformance/tests/directives_type_checking.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
from typing import TYPE_CHECKING, assert_type


if not TYPE_CHECKING:
a: int = "" # This should not generate an error
def foo(x: list[int], y: list[str]) -> None:
z: list[int] | list[str]

if TYPE_CHECKING:
b: list[int] = [1, 2, 3]
else:
b: list[str] = ["a", "b", "c"]
if TYPE_CHECKING:
z = x
else:
z = y

assert_type(b, list[int])
assert_type(z, list[int])