Skip to content

Commit 23c7ef3

Browse files
authored
fix Non-Numeric-u0 (#737)
* fix Non-Numeric-u0 * typo
1 parent 3b4893a commit 23c7ef3

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/NonlinearSolveBase/src/solve.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,8 @@ function solve_call(_prob, args...; merge_callbacks = true, kwargshandle = nothi
151151
throw(NonConcreteEltypeError(RecursiveArrayTools.recursive_unitless_eltype(_prob.u0)))
152152
end
153153

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

test/core_tests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,3 +444,10 @@ end
444444
sol = solve(prob)
445445
@test SciMLBase.successful_retcode(sol)
446446
end
447+
448+
@testitem "NonNumberEltype error" tags=[:core] begin
449+
u0_broken = [rand(2), rand(2)]
450+
f(u,p) = u
451+
prob = NonlinearProblem(f, u0_broken)
452+
@test_throws SciMLBase.NonNumberEltypeError solve(prob)
453+
end

0 commit comments

Comments
 (0)