-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add invalid type expressions. #16765
base: main
Are you sure you want to change the base?
Add invalid type expressions. #16765
Conversation
Expand `InvalidTypeExpression` enum to include number, bytes and boolean in type expression
I may be wrong, but it seems that byte literals are already handled here: ruff/crates/red_knot_python_semantic/src/types/infer.rs Lines 5445 to 5452 in 44aec36
And tested here: ruff/crates/red_knot_python_semantic/resources/mdtest/annotations/string.md Lines 88 to 89 in 44aec36
|
There's now a test failing at
I think this is expected though, as the generics are not implemented for SpecialForm i think? |
…and properly catch float 'literals' in type expresssions
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.
Thanks! I think you're mostly on the right track, but there's a few issues here to sort out
crates/red_knot_python_semantic/resources/mdtest/annotations/literal.md
Outdated
Show resolved
Hide resolved
crates/red_knot_python_semantic/resources/mdtest/annotations/invalid.md
Outdated
Show resolved
Hide resolved
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.
Looks close!
crates/red_knot_python_semantic/resources/mdtest/annotations/invalid.md
Outdated
Show resolved
Hide resolved
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.
looks great, thank you!
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
I'll wait until our CI's back up and running before merging this (everything's disabled at the moment due to #16768, we should get it up again tomorrow) |
Sounds good, thank you for the feedback! |
Expand
InvalidTypeExpression
enum to include number, bytes and boolean in type expressionSummary
Fixes #16532
Test Plan
Still need to look into where tests should be put for this improvement