File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,11 @@ class Definition(Binding):
263
263
"""
264
264
A binding that defines a function or a class.
265
265
"""
266
+ def redefines (self , other ):
267
+ return (
268
+ super ().redefines (other ) or
269
+ (isinstance (other , Assignment ) and self .name == other .name )
270
+ )
266
271
267
272
268
273
class Builtin (Definition ):
Original file line number Diff line number Diff line change @@ -118,6 +118,12 @@ def a(): pass
118
118
def a(): pass
119
119
''' , m .RedefinedWhileUnused )
120
120
121
+ def test_redefined_function_shadows_variable (self ):
122
+ self .flakes ('''
123
+ x = 1
124
+ def x(): pass
125
+ ''' , m .RedefinedWhileUnused )
126
+
121
127
def test_redefinedUnderscoreFunction (self ):
122
128
"""
123
129
Test that shadowing a function definition named with underscore doesn't
You can’t perform that action at this time.
0 commit comments