Skip to content

@extend does not work with parameters #3061

@baggepinnen

Description

@baggepinnen

When using @mtkmodel and @extend, the constructor does not know about the parameters of the extended system. MWE:

@mtkmodel Inner begin
    @parameters begin
        color[1:4] = [1.0, 0.0, 0.0, 1.0], [description = "Color of the body in animations"]
        render = true, [description = "Render the joint in animations"]
    end
end

@mtkmodel Outer begin
    @extend () = v = Inner()
    @parameters begin
        radius = 0.1, [description = "Radius of the sphere in animations"]
    end
end

@named test = Outer(color=[1,1,1,1])
julia> @named test = Outer(color=[1,1,1,1])
ERROR: MethodError: no method matching __Outer__(; name::Symbol, color::Vector{Int64})

Closest candidates are:
  __Outer__(; name, radius) got unsupported keyword argument "color"
   @ Main ~/.julia/packages/ModelingToolkit/UXr3S/src/systems/model_parsing.jl:138

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions