diff --git a/src/systems/model_parsing.jl b/src/systems/model_parsing.jl index 5b79eaa91b..5402659b1c 100644 --- a/src/systems/model_parsing.jl +++ b/src/systems/model_parsing.jl @@ -923,7 +923,7 @@ function parse_variable_arg(dict, mod, arg, varclass, kwargs, where_types) end push!(varexpr.args, metadata_expr) - return vv isa Num ? name : :($name...), varexpr + return symbolic_type(vv) == ScalarSymbolic() ? name : :($name...), varexpr else return vv end diff --git a/test/model_parsing.jl b/test/model_parsing.jl index fd223800e3..6ab7636b32 100644 --- a/test/model_parsing.jl +++ b/test/model_parsing.jl @@ -979,3 +979,14 @@ end @test MultipleExtend.structure[:extend][1] == [:inmodel, :b, :inmodel_b] @test tosymbol.(parameters(multiple_extend)) == [:b, :inmodel_b₊p, :inmodel₊p] end + +struct CustomStruct end +@testset "Nonnumeric parameters" begin + @mtkmodel MyModel begin + @parameters begin + p::CustomStruct + end + end + @named sys = MyModel(p = CustomStruct()) + @test ModelingToolkit.defaults(sys)[@nonamespace sys.p] == CustomStruct() +end