Skip to content

Commit cf246ba

Browse files
committed
Check states and parameters are actually states and parameters
Fix #1735
1 parent 5d94f39 commit cf246ba

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/utils.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ function check_parameters(ps, iv)
126126
for p in ps
127127
isequal(iv, p) &&
128128
throw(ArgumentError("Independent variable $iv not allowed in parameters."))
129+
isparameter(p) ||
130+
throw(ArgumentError("$p is not a parameter."))
129131
end
130132
end
131133

@@ -150,6 +152,8 @@ function check_variables(dvs, iv)
150152
throw(ArgumentError("Independent variable $iv not allowed in dependent variables."))
151153
(is_delay_var(iv, dv) || occursin(iv, dv)) ||
152154
throw(ArgumentError("Variable $dv is not a function of independent variable $iv."))
155+
isparameter(dv) &&
156+
throw(ArgumentError("$dv is not a state. It is a parameter."))
153157
end
154158
end
155159

0 commit comments

Comments
 (0)