Conversation
This comment has been minimized.
This comment has been minimized.
for more information, see https://pre-commit.ci
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
JukkaL
left a comment
There was a problem hiding this comment.
Does this have any behavior change? If yes, consider adding a test case.
| if e.fullname in LITERAL_NAMES: | ||
| return LITERAL_YES | ||
| elif isinstance(e.node, TypeAlias) and not e.node.python_3_12_type_alias: | ||
| if is_named_instance(e.node.target, LITERAL_NAMES): |
There was a problem hiding this comment.
Can a type alias refer to anything but None out of the options here? If this is case, maybe avoid LITERAL_NAMES.
There was a problem hiding this comment.
I basically just copied over previous code to prevent changes in behavior, but I don't think this can actually happen. (this is here because refers_to_fullname calls is_named_instance and is used in e.g. is_true_literal)
Probably, but I'm unable to construct an example which gets a change of behavior... (i.e. this makes |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Followup to #20492. This is basically just refactoring based on what seems more correct.