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

Precompilation Warning due to method overwritting #20

Closed
cmichelenstrofer opened this issue May 29, 2024 · 2 comments
Closed

Precompilation Warning due to method overwritting #20

cmichelenstrofer opened this issue May 29, 2024 · 2 comments

Comments

@cmichelenstrofer
Copy link
Contributor

I get this error. The same method signature seems to be defined in both lines 124 and 125. Are these two lines overwriting each other?

│  WARNING: Method definition edconvert(Unitful.Dimensions{(Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=-1, den=1)),)}, Union{Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=-1, den=1)),)}(), U}, Unitful.Level{L, S, Unitful.Quantity{T, Unitful.Dimensions{(Unitful.Dimension{:Time}(power=Base.Rational{Int64}(num=-1, den=1)),)}(), U}} where S where L} where U where T, DimensionfulAngles.Periodic) in module DimensionfulAngles at /Users/cmichel/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:124 overwritten at /Users/cmichel/.julia/packages/UnitfulEquivalences/JvL7D/src/UnitfulEquivalences.jl:125.
│  ERROR: Method overwriting is not permitted during Module precompilation. Use `__precompile__(false)` to opt-out of precompilation.
└  
@sostock
Copy link
Owner

sostock commented May 30, 2024

I assume this is with DimensionfulAngles v0.2.0, i.e., before cmichelenstrofer/DimensionfulAngles.jl#44? If I install DimensionfulAngles v0.2.1, it precompiles without warning.

The two lines overwrite each other if an equivalence between the same dimensions is defined, i.e., these lines DimensionfulAngles v0.2.0 (which were replaced in cmichelenstrofer/DimensionfulAngles.jl#44) cause the warning:
https://github.com/cmichelenstrofer/DimensionfulAngles.jl/blob/6d9678409be673a97079b3ec9b09721be20a0c58/src/equivalences.jl#L55-L64
This is because the edconvert method signature is the same for the conversion in both “directions”. The @eqrelation call defines two edconvert methods: one for conversion from dimension A to dimension B, and the other one from B to A. If A and B are the same, the same method signature is created twice).

Resolving #19 would make conversions between identical dimensions work with any equivalence, without having to define individual methods for it.

@cmichelenstrofer
Copy link
Contributor Author

Ah I ahd already fixed it... sorry and thanks! Came back to this project after a while and was still getting that error (maybe hadn't updated something). But confirmed, it now compiles without warnings. Default conversion between identical dimensions would be a neat addition.

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

2 participants