-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[red-knot] Enhancing Diagnostics for Compare Expression Inference #13819
[red-knot] Enhancing Diagnostics for Compare Expression Inference #13819
Conversation
|
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.
Thank you! Not at all a full review, just a couple of nits I spotted while skimming
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! I just have one minor naming comment; I'll push that and then merge.
} | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
struct OperatorUnsupportedError<'db> { |
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.
minor nit: perhaps this should be called BinaryOperatorUnsupportedError
, since there are also unsupported unary operations, but this error struct is only suitable for carrying information about a binary operator.
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.
Sorry, should be CompareOperatorUnsupportedError
, since this is actually specific to ast.CmpOp
. Or maybe for brevity could just be CompareUnsupportedError
.
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.
Actually, it’s coming from the rule name
( https://github.com/astral-sh/ruff/pull/13819/files#diff-65c2c229c88f4021638c996a7496384000d9e7b53b08426b34e92f120bd30b06R2783)
But you're right, CompareUnsupportedError makes more sense! I think the rule name could be updated as well, but it’s a pretty minor thing.
Summary
infer.rs
: Changed the return type fromOption
toResult
to lay the groundwork for providing more detailed diagnostics.This is a small step toward improving diagnostics in the future.
Please refer to #13787
Test Plan
mdtest included!