[ty] Add a note to the diagnostic if a new builtin is used on an old Python version (#18068)

## Summary

If the user tries to use a new builtin on an old Python version, tell
them what Python version the builtin was added on, what our inferred
Python version is for their project, and what configuration settings
they can tweak to fix the error.

## Test Plan

Snapshots and screenshots:


![image](https://github.com/user-attachments/assets/767d570e-7af1-4e1f-98cf-50e4311db511)
This commit is contained in:
Alex Waygood
2025-05-13 10:08:04 -04:00
committed by GitHub
parent 5bf5f3682a
commit c0f22928bd
4 changed files with 118 additions and 54 deletions

View File

@@ -0,0 +1,14 @@
# Diagnostics for unresolved references
## New builtin used on old Python version
<!-- snapshot-diagnostics -->
```toml
[environment]
python-version = "3.9"
```
```py
aiter # error: [unresolved-reference]
```