You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Various of the Unitful tests are broken when using julia --compiled-modules=no, due to the definition order of functions and methods relative to generated functions. For example
Construction: Error During Test at /home/tcfoster/.julia/dev/Unitful/test/runtests.jl:57
Test threw exception
Expression: 3 * (ContextUnits(m) / ContextUnits(m)) === 3
MethodError: no method matching ^(::Unitful.Unit{:Meter,𝐋}, ::Rational{Int64})
The applicable method may be too new: running in world age 25620, while current world is 26541.
Closest candidates are:
^(::Unitful.Unit{U,D}, ::Number) where {U, D} at /home/tcfoster/.julia/dev/Unitful/src/units.jl:105 (method too new to be called from this world context.)
^(!Matched::Missing, ::Number) at missing.jl:97
^(!Matched::Irrational{:ℯ}, ::Rational) at mathconstants.jl:91
...
Stacktrace:
[1] (::getfield(Unitful, Symbol("##4#5")))(::Unitful.Dimension{:Length}) at ./array.jl:0
[2] iterate(::Base.Generator{Tuple{Unitful.Dimension{:Length}},getfield(Unitful, Symbol("##4#5"))}) at ./generator.jl:47
[3] append_any(::Any, ::Vararg{Any,N} where N) at ./essentials.jl:674
[4] #s5#3(::Any, ::Any, ::Any) at /home/tcfoster/.julia/dev/Unitful/src/user.jl:306
[5] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N} where N) at ./boot.jl:522
[6] upreferred at /home/tcfoster/.julia/dev/Unitful/src/user.jl:329 [inlined]
[7] Unitful.ContextUnits(::Unitful.FreeUnits{(m,),𝐋,nothing}) at /home/tcfoster/.julia/dev/Unitful/src/types.jl:107
[8] top-level scope at /home/tcfoster/.julia/dev/Unitful/test/runtests.jl:57
[9] top-level scope at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Test/src/Test.jl:1083
[10] top-level scope at /home/tcfoster/.julia/dev/Unitful/test/runtests.jl:38
This seems to be the same root cause as #231 (ie, methods not defined at the time of generated function definition) but the fix is arguably a bit different as it requires changing the order of how functions are defined within Unitful itself.
I tried doing this, but I got confused by the interdependence between upreferred(:: and unary *(::FreeUnits). The backtraces seemed misleading.
The text was updated successfully, but these errors were encountered:
This is probably the next issue I'll tackle. I can get most of the tests to pass already but there are some subtle bugs that can give incorrect results without throwing MethodErrors.
ajkeller34
pushed a commit
to rigetti/Unitful.jl
that referenced
this issue
Jun 14, 2019
Various of the Unitful tests are broken when using
julia --compiled-modules=no
, due to the definition order of functions and methods relative to generated functions. For exampleThis seems to be the same root cause as #231 (ie, methods not defined at the time of generated function definition) but the fix is arguably a bit different as it requires changing the order of how functions are defined within Unitful itself.
I tried doing this, but I got confused by the interdependence between
upreferred(::
and unary*(::FreeUnits)
. The backtraces seemed misleading.The text was updated successfully, but these errors were encountered: