Skip to content

Renaming enum member to conflicting class name doesn't produce warning #6237

@Energeer

Description

@Energeer

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:

  1. Create the classes and module below.
  2. Use Rubberduck to rename Rectangular to Rectangle in IShape.
  3. 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.

Metadata

Metadata

Assignees

Labels

bugIdentifies work items for known bugs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions