-
Notifications
You must be signed in to change notification settings - Fork 316
Description
Rubberduck version information
Version 2.5.9.6321
OS: Microsoft Windows NT 10.0.19044.0, x64
Host Product: Microsoft Office x64
Host Version: 16.0.18324.20194
Host Executable: EXCEL.EXE
Description
Renaming an Enum member to the same name as a class breaks code. Rubberduck does not appear to warn about the conflict.
This probably falls somewhere between bug and feature request, but since I think notification of naming conflicts is a feature and doesn't appear in this case, I have labelled as a bug.
To Reproduce
Steps to reproduce the behavior:
- Create the classes and module below.
- Use Rubberduck to rename Rectangular to Rectangle in IShape.
- Run PrintShapeEnumAndName()
Run-time error '424': Object required
IShape.cls
Public Enum Shape
Rectangular
End Enum
Rectangle.cls
Public Property Get Name() as String
Name = "Rectangle"
End Property
Module1.bas
Public Sub PrintShapeEnumAndName()
Debug.Print Rectangular
With New Rectangle
Debug.Print .Name
End With
End Sub
Expected behavior
A warning that there is a naming conflict and code may break.
Additional context
This might seem like a small issue, and it’s on the user to name things properly to avoid conflicts. But in a big project with a lot of renaming, if you mess up, there doesn’t seem to be an easy way to fix it.