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

Allow checking if a model does NOT implement a given theory #175

Open
wants to merge 1 commit into
base: rem_model
Choose a base branch
from

Conversation

kris-brown
Copy link
Collaborator

@kris-brown kris-brown commented Dec 9, 2024

Addresses #174

This fixes the typo of the catch-all case, i.e.

implements(m::Module,::Type{Val{tag}}) where tag = nothing

We replace Module with Any.

However, the way we check whether or not an @instance call needs to define a new instance method is whether or not there are any methods implements(::ModelType, Val{specific_tag}). So now there is one that is always there by default.

One would think, then, that the correct way to fix this logic is to check whether or not there is exactly one method, rather than zero like before. However, because of how methods works, once some earlier @instance call has already defined the more specific implements method (which returns not nothing), it's not that there are now two methods but there still is just one (it's the newer, more specific one). So the logic check is to simply check whether or not the only method is equal to the catch-all case.

@kris-brown kris-brown added the bug Something isn't working label Dec 9, 2024
Copy link

codecov bot commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.48%. Comparing base (86e6d51) to head (3d4bf2c).

Additional details and impacted files
@@              Coverage Diff              @@
##           rem_model     #175      +/-   ##
=============================================
+ Coverage      95.43%   95.48%   +0.04%     
=============================================
  Files             38       38              
  Lines           2257     2258       +1     
=============================================
+ Hits            2154     2156       +2     
+ Misses           103      102       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kris-brown kris-brown self-assigned this Dec 9, 2024
@kris-brown kris-brown changed the base branch from main to rem_model December 9, 2024 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Checking if a model implements a theory leads to MethodNotFound error
2 participants