Open sgstepaniants opened 2 years ago
It works for me
julia> using TypedPolynomials
julia> @polyvar x
x
julia> p = 0*x
0
what is the crash you are seeing ?
Okay great, so I am running my code on the newest M1 mac and I've noticed that this problem appears when I run this MRE in visual studio code. If I run this MRE in the mac terminal everything works fine.
Running the above code in visual studio code gives me the following error:
┌ Error: Some Julia code in the VS Code extension crashed
└ @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.6.24/scripts/error_handler.jl:15
ERROR: MethodError: 0no method matching
zero
julia> )
)
Closest candidates are:
zero(::Union{Type{P}, P}) where P<:Dates.Period at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Dates/src/periods.jl:53
zero(::Union{Monomial, Polynomial, Term, Variable}) at ~/.julia/packages/TypedPolynomials/4RbPQ/src/operators.jl:5
zero(::MultivariatePolynomials.AbstractTermLike{T}) where T at ~/.julia/packages/MultivariatePolynomials/1bIGc/src/term.jl:168
...
julia>
julia> [1] iszero(x::Function)
@ Base ./number.jl:42
[2] _termeqconstant
@ ~/.julia/packages/MultivariatePolynomials/1bIGc/src/comparison.jl:33 [inlined]
[3] eqconstant
@ ~/.julia/packages/MultivariatePolynomials/1bIGc/src/comparison.jl:38 [inlined]
[4] ==
@ ~/.julia/packages/MultivariatePolynomials/1bIGc/src/operators.jl:46 [inlined]
[5] isequal
@ ./operators.jl:140 [inlined]
[6] (::Base.Fix2{typeof(isequal), Term{Int64, Monomial{(Variable{:x}(),), 1}}})(y::Function)
@ Base ./operators.jl:1153
[7] _any(f::Base.Fix2{typeof(isequal), Term{Int64, Monomial{(Variable{:x}(),), 1}}}, itr::Tuple{typeof(vscodedisplay), Module, Module, typeof(include), typeof(eval)}, #unused#::Colon)
@ Base ./reduce.jl:1110
[8] any(f::Function, itr::Tuple{typeof(vscodedisplay), Module, Module, typeof(include), typeof(eval)})
@ Base ./reduce.jl:1105
[9] getvariables()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.6.24/scripts/packages/VSCodeServer/src/trees.jl:281
[10] #invokelatest#2
@ ./essentials.jl:716 [inlined]
[11] invokelatest
@ ./essentials.jl:714 [inlined]
[12] repl_getvariables_request(conn::VSCodeServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, params::Nothing)
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.6.24/scripts/packages/VSCodeServer/src/trees.jl:269
[13] dispatch_msg(x::VSCodeServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::VSCodeServer.JSONRPC.MsgDispatcher, msg::Dict{String, Any})
@ VSCodeServer.JSONRPC ~/.vscode/extensions/julialang.language-julia-1.6.24/scripts/packages/JSONRPC/src/typed.jl:67
[14] dispatch_msg(conn_endpoint::Base.RefValue{Union{Nothing, VSCodeServer.JSONRPC.JSONRPCEndpoint}}, msg_dispatcher::VSCodeServer.JSONRPC.MsgDispatcher, msg::Dict{String, Any}, is_dev::Bool)
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.6.24/scripts/packages/VSCodeServer/src/VSCodeServer.jl:100
[15] macro expansion
@ ~/.vscode/extensions/julialang.language-julia-1.6.24/scripts/packages/VSCodeServer/src/VSCodeServer.jl:148 [inlined]
[16] macro expansion
@ ./task.jl:399 [inlined]
[17] macro expansion
@ ~/.vscode/extensions/julialang.language-julia-1.6.24/scripts/packages/VSCodeServer/src/VSCodeServer.jl:142 [inlined]
[18] (::VSCodeServer.var"#180#184"{Bool, String, Base.PipeEndpoint})()
@ VSCodeServer ./task.jl:423
I have a very surprising problem, it is impossible to create a Multivariate Polynomial that is constantly zero. This code crashes on my computer: