[ty] Narrow type context during collection literal inference#23844
[ty] Narrow type context during collection literal inference#23844ibraheemdev merged 3 commits intomainfrom
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 85.29%. The percentage of expected errors that received a diagnostic held steady at 78.13%. The number of fully passing files held steady at 64/132. |
|
Memory usage reportSummary
Significant changesClick to expand detailed breakdownprefect
flake8
trio
sphinx
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
1 | 102 | 4 |
no-matching-overload |
0 | 58 | 0 |
type-assertion-failure |
1 | 29 | 0 |
invalid-assignment |
1 | 4 | 3 |
unresolved-attribute |
2 | 0 | 0 |
unused-type-ignore-comment |
0 | 1 | 0 |
| Total | 5 | 194 | 7 |
Merging this PR will degrade performance by 9.83%
Performance Changes
Comparing Footnotes
|
| let prev_multi_inference = self.set_multi_inference_state(MultiInferenceState::Ignore); | ||
| let was_in_multi_inference = self.context.set_multi_inference(true); |
There was a problem hiding this comment.
Orthogonal issue, so not for this PR, but: should this be more ergonomic? Should the former always imply the latter? It's really not clear to a reader what the difference in semantics between self.set_multi_inference_state and self.context.set_multi_inference is, or why you'd need to call one vs the other.
There was a problem hiding this comment.
We're moving towards this direction, once we remove MultiInferenceState::Intersection this can just be a single "silent inference" flag.
ce0fc3f to
d1e3a85
Compare
|
Will try to address the performance regression in a follow up PR. |
* main: (94 commits) Fix shell injection via `shell=True` in subprocess calls (#23894) [ty] Refactor `relation.rs` to store state on a struct rather than passing around 7 arguments every time we recurse (#23837) Don't return code actions for non-Python documents (#23905) [ty] Make the default database truly statically infallible (#23929) [ty] Add `Download` button to ty playground which creates a zip export (#23478) [ty] Respect `kw_only` overwrites in dataclasses (#23930) [ty] Clarify in diagnostics that `from __future__ import annotations` only stringifies type annotations (#23928) [ty] Add a `Copy Markdown` button to playground (#23002) [ty] Fix folding range classification of lines starting with `#` (#23831) [ty] Fix folding ranges for notebooks (#23830) [ty] fix too-many-cycle panics when inferring literal type loop variables (#23875) Add `RegularCallableTypeOf` and `into_regular_callable` in `ty_extensions` (#23909) [ty] treat properties as full structural types (#23925) [ty] Avoid duplicated work during multi-inference (#23923) [ty]: make `possibly-missing-attribute` ignored by default [ty]: split out `possibly-missing-submodule` from `possibly-missing-attribute` Update astral-sh/setup-uv action to v7.5.0 (#23922) [ty] Show truthiness in ConstraintSet display and simplify falsy error message (#23913) Bump 0.15.6 (#23919) [ty] Narrow type context during collection literal inference (#23844) ...
Collection literals are effectively a special case of generic calls, so there's no reason we shouldn't be applying the same narrowing logic here.
Part of astral-sh/ty#3001.