Skip to content

Commit dc97063

Browse files
Merge pull request #3533 from AayushSabharwal/as/named-always-parentscope
[v10] feat: make `@named` always wrap arguments in `ParentScope`
2 parents 47faf84 + 7a6eb25 commit dc97063

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/systems/abstractsystem.jl

+1-5
Original file line numberDiff line numberDiff line change
@@ -2371,11 +2371,7 @@ function default_to_parentscope(v)
23712371
uv = unwrap(v)
23722372
uv isa Symbolic || return v
23732373
apply_to_variables(v) do sym
2374-
if !hasmetadata(uv, SymScope)
2375-
ParentScope(sym)
2376-
else
2377-
sym
2378-
end
2374+
ParentScope(sym)
23792375
end
23802376
end
23812377

test/components.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function rc_component(; name, R = 1, C = 1)
109109
@named p = Pin()
110110
@named n = Pin()
111111
@named resistor = Resistor(R = R) # test parent scope default of @named
112-
@named capacitor = Capacitor(C = ParentScope(C))
112+
@named capacitor = Capacitor(C = C)
113113
eqs = [connect(p, resistor.p);
114114
connect(resistor.n, capacitor.p);
115115
connect(capacitor.n, n)]

0 commit comments

Comments
 (0)