JuliaAlgebra / DynamicPolynomials.jl

Multivariate polynomials implementation of commutative and non-commutative variables
Other
60 stars 21 forks source link

Failing to precompile on Julia master #43

Closed lkapelevich closed 5 years ago

lkapelevich commented 5 years ago

I get the following error on Julia master

julia> using DynamicPolynomials
[ Info: Precompiling DynamicPolynomials [7c1d4256-1411-5781-91ec-d7bc3513ac07]
ERROR: LoadError: LoadError: TypeVar in Vararg length must have bounds Union{} and Any
Stacktrace:
 [1] top-level scope at /home/lea/.julia/packages/DynamicPolynomials/NSiPE/src/var.jl:74
 [2] include at ./boot.jl:328 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1094
 [4] include at ./Base.jl:31 [inlined]
 [5] include(::String) at /home/lea/.julia/packages/DynamicPolynomials/NSiPE/src/DynamicPolynomials.jl:1
 [6] top-level scope at /home/lea/.julia/packages/DynamicPolynomials/NSiPE/src/DynamicPolynomials.jl:8
 [7] include at ./boot.jl:328 [inlined]
 [8] include_relative(::Module, ::String) at ./loading.jl:1094
 [9] include(::Module, ::String) at ./Base.jl:31
 [10] top-level scope at none:2
 [11] eval at ./boot.jl:330 [inlined]
 [12] eval(::Expr) at ./client.jl:433
 [13] top-level scope at ./none:3
in expression starting at /home/lea/.julia/packages/DynamicPolynomials/NSiPE/src/var.jl:74
in expression starting at /home/lea/.julia/packages/DynamicPolynomials/NSiPE/src/DynamicPolynomials.jl:8
ERROR: Failed to precompile DynamicPolynomials [7c1d4256-1411-5781-91ec-d7bc3513ac07] to /home/lea/.julia/compiled/v1.3/DynamicPolynomials/tepBk.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1253
 [3] _require(::Base.PkgId) at ./loading.jl:1013
 [4] require(::Base.PkgId) at ./loading.jl:911
 [5] require(::Module, ::Symbol) at ./loading.jl:906

version info:

julia> versioninfo()
Julia Version 1.3.0-DEV.289
Commit e39f498aca (2019-05-25 00:10 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, ivybridge)
chriscoey commented 5 years ago

here is a similar error from a different package (now fixed): https://github.com/JuliaMath/Interpolations.jl/issues/322

Seems to have began with https://github.com/JuliaLang/julia/commit/516067b452db3bb52926c0e0660abf8c6658374e

lkapelevich commented 5 years ago

The problem is with const VarVec{C} = Union{AbstractVector{PolyVar{C}}, NTuple{<:Integer, PolyVar{C}}} but it looks like the only place where VarVec is used is MP.emptymonovec(vars::VarVec{C}). Are both types in the union necessary?

blegat commented 5 years ago

We could create two methods, one for each, instead of one for the union if that helps

lkapelevich commented 5 years ago

OK does emptymonovec need to be defined for the NTuple type at all? The method wouldn't get hit in tests and I guess I don't really understand when it would be used

blegat commented 5 years ago

Vector of variables can either be a Vector of AbstractVariable or a Tuple of AbstractVariable. For DynamicPolynomials, Vector is used and for TypedPolynomials, Tuple is used as different variables have different types. A user wanting to have his code work for both TypedPolynomials and DynamicPolynomials may use tuple of variables even with DynamicPolynomials and then use emptymonovec. We should add a test like

@polyvar x
@polyvar y
emptymonovec((x, y))

in MultivariatePolynomials if it is never called in tests

blegat commented 5 years ago

Solved by https://github.com/JuliaAlgebra/DynamicPolynomials.jl/pull/44. Should work on v0.2.1 once it is released

blegat commented 5 years ago

I had been released