diff --git a/src/systems/model_parsing.jl b/src/systems/model_parsing.jl index 4a8d73652c..f772abbb00 100644 --- a/src/systems/model_parsing.jl +++ b/src/systems/model_parsing.jl @@ -219,7 +219,7 @@ function generate_var!(dict, a, b, varclass; vd isa Vector && (vd = first(vd)) vd[a] = Dict{Symbol, Any}() var = if indices === nothing - Symbolics.variable(a, T = SymbolicUtils.FnType{Tuple{Real}, Real})(iv) + Symbolics.variable(a, T = SymbolicUtils.FnType{Tuple{Any}, Real})(iv) else vd[a][:size] = Tuple(lastindex.(indices)) first(@variables $a(iv)[indices...]) diff --git a/test/model_parsing.jl b/test/model_parsing.jl index f94d7483fd..f2a23037d3 100644 --- a/test/model_parsing.jl +++ b/test/model_parsing.jl @@ -329,10 +329,9 @@ end # Ensure that modules consisting MTKModels with component arrays and icons of # `Expr` type and `unit` metadata can be precompiled. module PrecompilationTest -using Unitful, Test, ModelingToolkit +push!(LOAD_PATH, joinpath(@__DIR__, "precompile_test")) +using Unitful, Test, ModelParsingPrecompile, ModelingToolkit @testset "Precompile packages with MTKModels" begin - push!(LOAD_PATH, joinpath(@__DIR__, "precompile_test")) - using ModelParsingPrecompile: ModelWithComponentArray @named model_with_component_array = ModelWithComponentArray() @@ -539,3 +538,16 @@ end @test Equation[ternary_true.ternary_parameter_true ~ 0] == equations(ternary_true) @test Equation[ternary_false.ternary_parameter_false ~ 0] == equations(ternary_false) end + +_b = Ref{Any}() +@mtkmodel MyModel begin + @variables begin + x___(t) = 0 + end + begin + _b[] = x___ + end +end +@named m = MyModel() +@variables t x___(t) +@test isequal(x___, _b[])