Fix: no generic inlay hints for map filter for #1796#1797
Merged
DetachHead merged 4 commits intoMay 11, 2026
Conversation
Add `map(int, nums)` and `filter(int, nums)` cases to the `inlay_hints/generics.py` sample. These calls reproduce the scenario from issue DetachHead#1796 where generic inlay hints can suggest invalid runtime syntax like `map[int](...)`.
Prevent generic inlay hints from being shown for builtins that are generic in stubs but not subscriptable at runtime. Specifically, skip generic inlay hint generation for `builtins.map` and `builtins.filter` in `TypeInlayHintsWalker`. This avoids misleading hints such as `map[int](...)` that can lead to runtime `TypeError`. This addresses issue DetachHead#1796.
DetachHead
reviewed
May 9, 2026
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
DetachHead
reviewed
May 9, 2026
This comment has been minimized.
This comment has been minimized.
Keep nonSubscriptableTypes in typeEvaluator.ts and expose isRuntimeSubscriptableClass on the TypeEvaluator interface. Use evaluator.isRuntimeSubscriptableClass(...) in typeInlayHintsWalker and reuse the same function in typeEvaluator index diagnostics.
ee4e989 to
b0c3dc3
Compare
DetachHead
approved these changes
May 11, 2026
Contributor
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.