Skip to content

Commit

Permalink
Merge pull request #1210 from JuliaSymbolics/ChrisRackauckas-patch-1
Browse files Browse the repository at this point in the history
Remove Requires.jl
  • Loading branch information
ChrisRackauckas authored Aug 10, 2024
2 parents 4ebce37 + 5fa2658 commit d995c49
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 32 deletions.
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
Expand Down Expand Up @@ -81,7 +80,6 @@ PrecompileTools = "1"
RecipesBase = "1.1"
Reexport = "1"
ReferenceTests = "0.9"
Requires = "1.1"
RuntimeGeneratedFunctions = "0.5.9"
SciMLBase = "2"
Setfield = "1"
Expand Down
45 changes: 15 additions & 30 deletions src/Symbolics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -200,36 +200,21 @@ end
function symbolics_to_sympy end
export symbolics_to_sympy

include("../ext/SymbolicsForwardDiffExt.jl")
using ..SymbolicsForwardDiffExt

@static if !isdefined(Base, :get_extension)
using Requires
end

@static if !isdefined(Base,:get_extension)
function __init__()
@require Groebner="0b43b601-686d-58a3-8a1c-6623616c7cd4" begin
include("../ext/SymbolicsGroebnerExt.jl")
end
@require SymPy="24249f21-da20-56a4-8eb1-6a02cf4ae2e6" begin
include("../ext/SymbolicsSymPyExt.jl")
end
Base.Experimental.register_error_hint(TypeError) do io, exc
if exc.expected == Bool && exc.got isa Num
println(io,
"\nA symbolic expression appeared in a Boolean context. This error arises in situations where Julia expects a Bool, like ")
printstyled(io, "if boolean_condition", color = :blue)
printstyled(
io, "\t\t use ifelse(boolean_condition, then branch, else branch)\n",
color = :green)
printstyled(io, "x && y", color = :blue)
printstyled(io, "\t\t\t\t use x & y\n", color = :green)
printstyled(io, "boolean_condition ? a : b", color = :blue)
printstyled(io, "\t use ifelse(boolean_condition, a, b)\n", color = :green)
print(io,
"but a symbolic expression appeared instead of a Bool. For help regarding control flow with symbolic variables, see https://docs.sciml.ai/ModelingToolkit/dev/basics/FAQ/#How-do-I-handle-if-statements-in-my-symbolic-forms?")
end
function __init__()
Base.Experimental.register_error_hint(TypeError) do io, exc
if exc.expected == Bool && exc.got isa Num
println(io,
"\nA symbolic expression appeared in a Boolean context. This error arises in situations where Julia expects a Bool, like ")
printstyled(io, "if boolean_condition", color = :blue)
printstyled(
io, "\t\t use ifelse(boolean_condition, then branch, else branch)\n",
color = :green)
printstyled(io, "x && y", color = :blue)
printstyled(io, "\t\t\t\t use x & y\n", color = :green)
printstyled(io, "boolean_condition ? a : b", color = :blue)
printstyled(io, "\t use ifelse(boolean_condition, a, b)\n", color = :green)
print(io,
"but a symbolic expression appeared instead of a Bool. For help regarding control flow with symbolic variables, see https://docs.sciml.ai/ModelingToolkit/dev/basics/FAQ/#How-do-I-handle-if-statements-in-my-symbolic-forms?")
end
end
end
Expand Down

0 comments on commit d995c49

Please sign in to comment.