Skip to content
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

using renamed components in #defcomposite #698

Merged
merged 9 commits into from
Apr 10, 2020
Merged

using renamed components in #defcomposite #698

merged 9 commits into from
Apr 10, 2020

Conversation

lrennels
Copy link
Collaborator

@codecov
Copy link

codecov bot commented Apr 10, 2020

Codecov Report

Merging #698 into master will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #698      +/-   ##
==========================================
+ Coverage   79.16%   79.20%   +0.03%     
==========================================
  Files          39       39              
  Lines        2851     2851              
==========================================
+ Hits         2257     2258       +1     
+ Misses        594      593       -1     
Flag Coverage Δ
#unittests 79.20% <100.00%> (+0.03%) ⬆️
Impacted Files Coverage Δ
src/core/defcomposite.jl 82.27% <100.00%> (+1.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d5498b...41fee79. Read the comment docs.

@corakingdon
Copy link
Collaborator

I think this error will also need to be addressed not just for Parameter statements but also Variable statements and connect statements. Here's an expanded example to hit all three:

@defcomp A begin
    p1 = Parameter()
    p2 = Parameter()

    v1 = Variable()
end

@defcomp B begin
    v2 = Variable()
end

@defcomposite C begin

    foo = Component(A)
    bar = Component(B) 

    rename_p1 = Parameter(foo.p1) 

    connect(foo.p2, bar.v2)

    rename_v1 = Variable(foo.v1)
end

@lrennels
Copy link
Collaborator Author

@ckingdon95 the macro yields the following with the @defcomposite C call (in a let block but I removed that for now)

cc_id = Mimi.ComponentId(Main, :C)
obj = Mimi.CompositeComponentDef(cc_id)

#= /Users/lisarennels/.julia/dev/Mimi/src/core/defcomposite.jl:183 =#
global C = obj

#= /Users/lisarennels/.julia/dev/Mimi/src/core/defcomposite.jl:184 =#
Mimi.add_comp!(obj, A, :foo)
Mimi.add_comp!(obj, B, :bar)
Mimi.import_param!(obj, :rename_p1, obj[:foo] => :p1; )
Mimi.connect_param!(obj, :foo, :p2, :bar, :v2; )
Mimi._import_var!(obj, :rename_v1, ComponentPath(:foo,), :v1)

#= /Users/lisarennels/.julia/dev/Mimi/src/core/defcomposite.jl:185 =#
Mimi.import_params!(obj)

#= /Users/lisarennels/.julia/dev/Mimi/src/core/defcomposite.jl:186 =#
C

@lrennels
Copy link
Collaborator Author

Note from conversation: This macro expand looks good, next step is to move the wip file to testing, perhaps test for keys like:

@test (:foo, :bar, :rename_p1, :rename_v1) in keys(C.namespace)

@lrennels lrennels requested a review from corakingdon April 10, 2020 20:02
@lrennels lrennels marked this pull request as ready for review April 10, 2020 20:35
@lrennels lrennels merged commit b052bf2 into master Apr 10, 2020
@lrennels lrennels deleted the rename branch April 10, 2020 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants