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

Agents macro allows parametric types and subtyping #843

Merged
merged 3 commits into from
Aug 11, 2023
Merged

Conversation

Tortar
Copy link
Member

@Tortar Tortar commented Aug 9, 2023

this should solve #725 , can you @mastrof say to me if this is what you intended and that it works for your use case please?

Now this works:

using Agents
abstract type AbstractFoo{D} <: AbstractAgent where D end
@agent MyFoo2{D} ContinuousAgent{D} where D AbstractFoo{D} begin; end

@codecov-commenter
Copy link

codecov-commenter commented Aug 9, 2023

Codecov Report

Merging #843 (1112553) into main (3ac17b8) will increase coverage by 0.56%.
Report is 1 commits behind head on main.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #843      +/-   ##
==========================================
+ Coverage   70.18%   70.75%   +0.56%     
==========================================
  Files          42       42              
  Lines        2727     2773      +46     
==========================================
+ Hits         1914     1962      +48     
+ Misses        813      811       -2     
Files Changed Coverage Δ
src/core/agents.jl 100.00% <ø> (ø)

... and 4 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mastrof
Copy link
Contributor

mastrof commented Aug 9, 2023

Yes that's what I needed, thanks a lot.

@Tortar
Copy link
Member Author

Tortar commented Aug 11, 2023

with the latest commit

using Agents
abstract type AbstractFoo{D} <: AbstractAgent where D end
@agent MyFoo2{D} ContinuousAgent{D} AbstractFoo{D} begin end

works!

edit:

but it has the side effect that

using Agents
abstract type AbstractFoo{D} <: AbstractAgent where D end
@agent MyFoo2{D} ContinuousAgent{D, D} AbstractFoo{D} begin end

also works, which doesn't make sense, so I reverted the change in the latest commit

@Tortar Tortar mentioned this pull request Aug 11, 2023
@Tortar Tortar merged commit 7bc8cea into main Aug 11, 2023
5 checks passed
@Tortar Tortar deleted the parametric-allowed branch August 11, 2023 13:19
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.

3 participants