Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions lib/NonlinearSolveBase/src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,8 @@ function solve_call(_prob, args...; merge_callbacks = true, kwargshandle = nothi
throw(NonConcreteEltypeError(RecursiveArrayTools.recursive_unitless_eltype(_prob.u0)))
end

if !(eltype(_prob.u0) <: Number) && !(eltype(_prob.u0) <: Enum) &&
!(_prob.u0 isa AbstractVector{<:AbstractArray} && _prob isa BVProblem)
# Allow Enums for FunctionMaps, make into a trait in the future
# BVPs use Vector of Arrays for initial guesses
throw(NonNumberEltypeError(eltype(_prob.u0)))
if !(eltype(_prob.u0) <: Number) && !(eltype(_prob.u0) <: Enum)
throw(SciMLBase.NonNumberEltypeError(eltype(_prob.u0)))
end
end

Expand Down
7 changes: 7 additions & 0 deletions test/core_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -444,3 +444,10 @@ end
sol = solve(prob)
@test SciMLBase.successful_retcode(sol)
end

@testitem "NonNumberEltype error" tags=[:core] begin
u0_broken = [rand(2), rand(2)]
f(u,p) = u
prob = NonlinearProblem(f, u0_broken)
@test_throws SciMLBase.NonNumberEltypeError solve(prob)=
end
Loading