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

Improve identifier clash errors when conflicting identifier is declared in @aliases decorator #570

Open
triallax opened this issue Sep 18, 2024 · 0 comments

Comments

@triallax
Copy link
Contributor

triallax commented Sep 18, 2024

i'm implementing #441, and there's a confusing error due to a conflict happening here:

@name("Malaysian ringgit")
@url("https://en.wikipedia.org/wiki/Malaysian_ringgit")
@aliases(malaysian_ringgits, MYR: short, myr, RM, rm)
unit malaysian_ringgit: Money = EUR / exchange_rate("MYR")

and the error:

>>> usd
error: identifier clash in definition
    ┌─ Module 'units::time', File <builtin>/modules/units/time.nbt:32:6
    │
 32 │ unit year: Time = 365.242_188_1 days
    │      ---- Previously defined here
    │
    ┌─ Module 'units::currencies', File <builtin>/modules/units/currencies.nbt:104:6
    │
104 │ unit malaysian_ringgit: Money = EUR / exchange_rate("MYR")
    │      ^^^^^^^^^^^^^^^^^ identifier is already in use

the conflict is between myr as malaysian_ringgit and myr as milliyear, but the error points to the primary identifiers malaysian_ringgit and year instead of the relevant aliases, and it also doesn't mention anything about the unit prefix

can this error be made clearer?

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

No branches or pull requests

1 participant