Skip to content

Fix name type inference when used as in a subscript #958

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

Merged

Conversation

nelfin
Copy link
Contributor

@nelfin nelfin commented Apr 22, 2021

Steps

  • For new features or bug fixes, add a ChangeLog entry describing what your PR does.
  • Write a good description on what the PR does.

Description

When used in a nodes.Subscript, an existing inference_tip was set for Name nodes matching called type. However, when this name was redefined this led to false-positive typecheck errors in pylint such as invalid-sequence-index (see pylint-dev/pylint#4083 and pylint-dev/pylint#4387)

Type of Changes

Type
🐛 Bug fix

Related Issue

See above

@nelfin nelfin force-pushed the fix/pylint4083-name-type-inference branch 2 times, most recently from 25904b9 to ec3d0af Compare April 22, 2021 08:19
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the merge request ! I just have two minor comments.

nelfin added 2 commits May 2, 2021 10:52
Ref pylint-dev/pylint#4083. Ref pylint-dev/pylint#4387. When used in a
nodes.Subscript, an existing inference_tip was set for Name nodes
matching called type. However, when this name was redefined this led to
false-positive typecheck errors in pylint such as invalid-sequence-index
due to the argument being inferred as builtins.type and inference_tip
preventing any further inference.
@nelfin nelfin force-pushed the fix/pylint4083-name-type-inference branch from ec3d0af to 2a8ab1a Compare May 2, 2021 00:55
@Pierre-Sassoulas Pierre-Sassoulas merged commit 7ae5f4b into pylint-dev:master May 2, 2021
@nelfin nelfin deleted the fix/pylint4083-name-type-inference branch May 2, 2021 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants