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

Fix enums/errors case names shadowing parameters to top level type names #95

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arg0d
Copy link
Collaborator

@arg0d arg0d commented Oct 4, 2024

If associated enum class name matches it's parameter type name, prefix the parameter type with package namespace to restrict the compiler from picking the associated enum class instead of top level type definition

Before

public record Rectangle(double @width, double @height) { }
public record Shape
{                    ____________
                     ∨          ∧
    public record Rectangle(Rectangle @s) : Shape { }
    public record Ellipse(Ellipse @s) : Shape { }
}

After

namespace my_namespace;
public record Rectangle(double @width, double @height) { }
public record Shape ^_______________________
{                                           ^
    public record Rectangle(my_namespace.Rectangle @s) : Shape { }
    public record Ellipse(Ellipse @s) : Shape { }
}

Fixes #60

@itrumper

@arg0d arg0d requested a review from Lipt0nas October 4, 2024 14:33
@arg0d arg0d changed the title Fix enums/errors case names conflicting with parameters to top level type names Fix enums/errors case names shadowing with parameters to top level type names Oct 4, 2024
@arg0d arg0d changed the title Fix enums/errors case names shadowing with parameters to top level type names Fix enums/errors case names shadowing parameters to top level type names Oct 4, 2024
@arg0d arg0d force-pushed the kristupas/issue-60 branch 2 times, most recently from 5f8834d to 60e8550 Compare October 4, 2024 14:35
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.

Generated code from Enum in Rust has errors
1 participant