rafaqz / UnitfulMoles.jl

Utilities for working with Mole units for the Julia language
Other
15 stars 2 forks source link

Documenter / GitHub action error due to @compound #14

Closed AlexisRenchon closed 2 years ago

AlexisRenchon commented 2 years ago

Hi,

I use Documenter to make my docs in a package, since I started using UnitfulMoles.jl @compound, I get the following error message from GitHub action:

Run julia --project=docs/ docs/make.jl
ERROR: LoadError: Evaluation into the closed module `UnitfulMoles` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `UnitfulMoles` with `eval` during precompilation - don't do this.
Stacktrace:
  [1] eval
    @ ./boot.jl:368 [inlined]
  [2] eval
    @ ~/.julia/packages/UnitfulMoles/RTl52/src/UnitfulMoles.jl:1 [inlined]
  [3] getweight(arg::SubString{String})
    @ UnitfulMoles ~/.julia/packages/UnitfulMoles/RTl52/src/UnitfulMoles.jl:168
  [4] var"@compound"(__source__::LineNumberNode, __module__::Module, name::Symbol)
    @ UnitfulMoles ~/.julia/packages/UnitfulMoles/RTl52/src/UnitfulMoles.jl:78
  [5] include
    @ ./Base.jl:417 [inlined]
  [6] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
    @ Base ./loading.jl:1373
  [7] top-level scope
    @ none:1
  [8] eval
    @ ./boot.jl:368 [inlined]
  [9] eval(x::Expr)
    @ Base.MainInclude ./client.jl:462
 [10] top-level scope
    @ none:1
in expression starting at /home/runner/work/DAMMmodel.jl/DAMMmodel.jl/src/DAMMmodel.jl:12
in expression starting at /home/runner/work/DAMMmodel.jl/DAMMmodel.jl/src/DAMMmodel.jl:1

the expression in DAMMmodel.jl line 12 is @compound CO2

Is this a known issue? Do you know how to fix it?

rafaqz commented 2 years ago

Its probably a bug with escaping in the @compound macro.

AlexisRenchon commented 2 years ago

do you think there is a way around it for Documenter?

rafaqz commented 2 years ago

We probably just have to fix the macro.

AlexisRenchon commented 2 years ago

It also crashes for Julia Registry, making UnitfulMoles unusable as a package dependency if you use @compound. Same error message, during AutoMerge

rafaqz commented 2 years ago

Sure, you shouldn't register it anyway with a bug like that ;)

I will look at fixing it today, I imagine its only a small change. But I wrote the code a few years ago so we will see.