mirror of https://github.com/astral-sh/ruff
This is intended to fix the one failing test from the previous commit.
And it actually does fix it! But it also causes a huge number of other
tests to fail. The minimized repro seems to be this:
```
$ cat test.py
class Foo:
pass
foo = Foo()
$ ty check test.py
error[panic]: Panicked at crates/ty_python_semantic/src/types.rs:156:38 when checking `/tmp/test.py`: `Failed to retrieve the inferred type for an `ast::Expr` node passed to `TypeInference::expression_type()`. The `TypeInferenceBuilder` should infer and store types for all `ast::Expr` nodes in any `TypeInference` region it analyzes.`
info: This indicates a bug in ty.
info: If you could open an issue at https://github.com/astral-sh/ty/issues/new?title=%5Bpanic%5D, we'd be very appreciative!
info: Platform: linux x86_64
info: Args: ["/home/jacko/astral/ruff/target-mold/debug/ty", "check", "test.py"]
info: run with `RUST_BACKTRACE=1` environment variable to show the full backtrace information
info: query stacktrace:
0: FunctionType < 'db >::signature_(Id(5007))
at crates/ty_python_semantic/src/types/function.rs:595
cycle heads: infer_scope_types(Id(c62)) -> IterationCount(0), FunctionType < 'db >::signature_(Id(5007)) -> IterationCount(0), FunctionType < 'db >::signature_(Id(5000)) -> IterationCount(0)
1: infer_expression_types(Id(1463))
at crates/ty_python_semantic/src/types/infer.rs:235
2: infer_definition_types(Id(11ab))
at crates/ty_python_semantic/src/types/infer.rs:159
3: infer_scope_types(Id(c62))
at crates/ty_python_semantic/src/types/infer.rs:130
cycle heads: infer_scope_types(Id(c62)) -> IterationCount(0)
4: FunctionType < 'db >::signature_(Id(5000))
at crates/ty_python_semantic/src/types/function.rs:595
5: infer_expression_types(Id(1400))
at crates/ty_python_semantic/src/types/infer.rs:235
6: infer_definition_types(Id(1001))
at crates/ty_python_semantic/src/types/infer.rs:159
7: infer_scope_types(Id(c00))
at crates/ty_python_semantic/src/types/infer.rs:130
8: check_file_impl(Id(800))
at crates/ty_project/src/lib.rs:474
```
|
||
|---|---|---|
| .. | ||
| ruff | ||
| ruff_annotate_snippets | ||
| ruff_benchmark | ||
| ruff_cache | ||
| ruff_db | ||
| ruff_dev | ||
| ruff_diagnostics | ||
| ruff_formatter | ||
| ruff_graph | ||
| ruff_index | ||
| ruff_linter | ||
| ruff_macros | ||
| ruff_notebook | ||
| ruff_options_metadata | ||
| ruff_python_ast | ||
| ruff_python_ast_integration_tests | ||
| ruff_python_codegen | ||
| ruff_python_formatter | ||
| ruff_python_index | ||
| ruff_python_literal | ||
| ruff_python_parser | ||
| ruff_python_semantic | ||
| ruff_python_stdlib | ||
| ruff_python_trivia | ||
| ruff_python_trivia_integration_tests | ||
| ruff_server | ||
| ruff_source_file | ||
| ruff_text_size | ||
| ruff_wasm | ||
| ruff_workspace | ||
| ty | ||
| ty_ide | ||
| ty_project | ||
| ty_python_semantic | ||
| ty_server | ||
| ty_static | ||
| ty_test | ||
| ty_vendored | ||
| ty_wasm | ||