-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
crashtopic-pep-695Issues related to PEP 695 syntaxIssues related to PEP 695 syntaxtopic-type-aliasTypeAlias and other type alias issuesTypeAlias and other type alias issuestopic-type-variables
Description
The following example passes on 1.17.1, but crashes on 1.18.1, 1.18.2 and main (1.19.0+dev.841db1f7e537b1ac15c8866bec574c04ce125554) with message AssertionError: Must not defer during final iteration
type JSON_SCALAR = None | bool | int | float | str
type JSON_ARRAY[T: JSON] = list[T]
type JSON = JSON_SCALAR | JSON_ARRAY[JSON]- https://mypy-play.net/?mypy=1.17.1&python=3.12&gist=baf174591dd1638b5576874281c1ee00: no issues
- https://mypy-play.net/?mypy=1.18.1&python=3.12&gist=fa3ddab26e924915f24c57c190d6a677: Crash
- https://mypy-play.net/?mypy=master&python=3.12&gist=0cac137d39b634f395a3c2c451d80241: Crash
I tested with python 3.12–3.14.
Traceback
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/__main__.py", line 37, in <module>
console_entry()
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
main()
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/main.py", line 127, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/main.py", line 211, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/build.py", line 213, in build
result = _build(
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/build.py", line 292, in _build
graph = dispatch(sources, manager, stdout)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/build.py", line 2931, in dispatch
process_graph(graph, manager)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/build.py", line 3322, in process_graph
done, still_working = manager.wait_for_done(graph)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/build.py", line 915, in wait_for_done
process_stale_scc(graph, next_scc, self)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/build.py", line 3454, in process_stale_scc
mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal_main.py", line 95, in semantic_analysis_for_scc
process_top_levels(graph, scc, patches)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal_main.py", line 222, in process_top_levels
deferred, incomplete, progress = semantic_analyze_target(
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal_main.py", line 399, in semantic_analyze_target
analyzer.refresh_partial(
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 658, in refresh_partial
self.refresh_top_level(node)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 676, in refresh_top_level
self.accept(d)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 7392, in accept
node.accept(self)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/nodes.py", line 1951, in accept
return visitor.visit_type_alias_stmt(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 5598, in visit_type_alias_stmt
self.mark_incomplete(s.name.name, s.value, becomes_typeinfo=True)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 7084, in mark_incomplete
self.defer(node)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 7038, in defer
assert not self.final_iteration, "Must not defer during final iteration"
^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Must not defer during final iteration
main.py:2: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.19.0+dev.fb16e938d12f6b24b5edf8023d4adf8e0e36abb4
main.py:2: : note: use --pdb to drop into pdb
Metadata
Metadata
Assignees
Labels
crashtopic-pep-695Issues related to PEP 695 syntaxIssues related to PEP 695 syntaxtopic-type-aliasTypeAlias and other type alias issuesTypeAlias and other type alias issuestopic-type-variables