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

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

arg0d
Copy link
Contributor

@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 force-pushed the kristupas/issue-60 branch from b8ed8aa to 599678f Compare October 4, 2024 14:34
@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 3 times, most recently from 60e8550 to f3dd13d Compare October 11, 2024 13:38
@arg0d arg0d force-pushed the kristupas/issue-60 branch from f3dd13d to e86e612 Compare January 16, 2025 11:06
…type names

Signed-off-by: Kristupas Antanavičius <kristupas.antanavicius@nordsec.com>
@arg0d arg0d force-pushed the kristupas/issue-60 branch from e86e612 to 3096aad Compare January 16, 2025 11:11
@arg0d arg0d merged commit 6a67bff into main Jan 16, 2025
3 checks passed
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