Skip to content
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 TypeAlias.assigned_stmts() #2252

Merged

Conversation

jacobtylerwalls
Copy link
Member

Type of Changes

Type
🐛 Bug fix
✨ New feature

Description

This partially reverts commit a82384a. (I wasn't ready to add this until I knew what it was and whether the other two nodes needed it 😄 .) Only the TypeAlias can assign a name in the current scope.

Prevents this failure in pylint:

type X = float
if X:
    print(X)
  File "/Users/<user>/astroid/astroid/protocols.py", line 345, in assend_assigned_stmts
    return self.parent.assigned_stmts(node=self, context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TypeAlias' object has no attribute 'assigned_stmts'

This partially reverts commit a82384a.
@codecov
Copy link

codecov bot commented Jul 16, 2023

Codecov Report

Merging #2252 (3b6ce3d) into main (4c3bebb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2252   +/-   ##
=======================================
  Coverage   92.80%   92.80%           
=======================================
  Files          94       94           
  Lines       10941    10942    +1     
=======================================
+ Hits        10154    10155    +1     
  Misses        787      787           
Flag Coverage Δ
linux 92.61% <100.00%> (+<0.01%) ⬆️
pypy 90.89% <100.00%> (+<0.01%) ⬆️
windows 92.37% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
astroid/protocols.py 90.19% <ø> (ø)
astroid/nodes/node_classes.py 94.82% <100.00%> (+<0.01%) ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants