Skip to content

Commit 935f99d

Browse files
committed
fix bug
1 parent 0aac102 commit 935f99d

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/qobj/quantum_object_evo.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ Parse the `op_func_list` and generate the data for the `QuantumObjectEvolution`
381381

382382
op = :(op_func_list[$i][1])
383383
dims_expr = (dims_expr..., :($op.dimensions))
384-
func_methods_expr = (func_methods_expr..., :(methods(op_func_list[$i][2], [Any, Real]))) # [Any, Real] means each func must accept 2 arguments
384+
func_methods_expr = (func_methods_expr..., :(methods(op_func_list[$i][2], [Any, Real]).ms)) # [Any, Real] means each func must accept 2 arguments
385385
if i == 1
386386
first_op = :($op)
387387
end
@@ -406,10 +406,10 @@ Parse the `op_func_list` and generate the data for the `QuantumObjectEvolution`
406406

407407
# check if each func accepts 2 arguments
408408
func_methods = tuple($(func_methods_expr...))
409-
for f_method in func_methods
410-
length(f_method.mt) == 0 && throw(
409+
for i in eachindex(func_methods)
410+
length(func_methods[i]) == 0 && throw(
411411
ArgumentError(
412-
"The following function must accept two arguments: `$(f_method.mt.name)(p, t)` with t<:Real",
412+
"The following function must only accept two arguments: `$(nameof(op_func_list[i][2]))(p, t)` with t<:Real",
413413
),
414414
)
415415
end

src/time_evolution/brmesolve.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ function brmesolve(
189189
end
190190

191191
function _check_br_spectra(f::Function)
192-
meths = methods(f, [Real])
193-
length(meths.mt) == 0 &&
194-
throw(ArgumentError("The following function must accept one argument: `$(meths.mt.name)(ω)` with ω<:Real"))
192+
length(methods(f, [Real]).ms) == 0 &&
193+
throw(ArgumentError("The following function must only accept one argument: `$(nameof(f))(ω)` with ω<:Real"))
195194
return nothing
196195
end

0 commit comments

Comments
 (0)