[ty] Improve invalid-type-form diagnostic where a module-literal type is used in a type expression and the module has a member which would be valid in a type expression by AlexWaygood · Pull Request #18244 · astral-sh/ruff (original) (raw)

Summary

It's fairly common in Python do to something like this:

import datetime

x: datetime

when you actually meant to do this:

import datetime

x: datetime.datetime

This PR adds subdiagnostics to hint to the user what the cause of the invalid-type-form error might be in cases like this.

Closes astral-sh/ty#373

Test Plan

Snapshots