ruff
3f22497b - WIP: defer walking function bodies to end-of-scope in SemanticIndexBuilder

Commit
323 days ago
WIP: defer walking function bodies to end-of-scope in SemanticIndexBuilder 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 ```
Author
Committer
Parents
Loading