Skip to content

[v10] feat: make @named always wrap arguments in ParentScope #3533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/systems/abstractsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2371,11 +2371,7 @@ function default_to_parentscope(v)
uv = unwrap(v)
uv isa Symbolic || return v
apply_to_variables(v) do sym
if !hasmetadata(uv, SymScope)
ParentScope(sym)
else
sym
end
ParentScope(sym)
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/components.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function rc_component(; name, R = 1, C = 1)
@named p = Pin()
@named n = Pin()
@named resistor = Resistor(R = R) # test parent scope default of @named
@named capacitor = Capacitor(C = ParentScope(C))
@named capacitor = Capacitor(C = C)
eqs = [connect(p, resistor.p);
connect(resistor.n, capacitor.p);
connect(capacitor.n, n)]
Expand Down
Loading