-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[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
#18244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
...ests_for_invalid_ty…_-_Diagnostics_for_comm…_-_Module-literal_used_…_(652fec4fd4a6c63a).snap
Outdated
Show resolved
Hide resolved
|
|
you have to leave some diagnostic improvements to contributors ;) |
…pe is used in a type expression and the module has a member which would be valid in a type expression
fdf2569 to
bc9d7f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not something directly related to this PR, but these info lines are inconsistent in their capitalizations and punctuations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I'd argue that the message is a bit awkwardly phrased. How about this?
Did you mean to use its member
Image.Imageinstead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a nice shortening, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not something directly related to this PR, but these
infolines are inconsistent in their capitalizations and punctuations.
(I agree that this is inconsistent, but I don't plan to address it in this PR since it predates this PR)
Summary
It's fairly common in Python do to something like this:
when you actually meant to do this:
This PR adds subdiagnostics to hint to the user what the cause of the
invalid-type-formerror might be in cases like this.Closes astral-sh/ty#373
Test Plan
Snapshots