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

Unable to check interface from outside a module #58

Open
tk3369 opened this issue Nov 26, 2021 · 0 comments
Open

Unable to check interface from outside a module #58

tk3369 opened this issue Nov 26, 2021 · 0 comments

Comments

@tk3369
Copy link
Owner

tk3369 commented Nov 26, 2021

If I define a module and then try to verify interfaces from outside of the module, it gets confused:

julia> module Foo
           using BinaryTraits
           using BinaryTraits.Prefix: Is
           @trait Cute
           @implement Is{Cute} by awesome(_)
           struct Wat end
           @assign Wat with Is{Cute}
       end

julia> @check Foo.Wat
✅ Main.Foo.Wat has no interface contract requirements.

The workaround is to run the check inside the module, or expose a method to do that:

julia> module Bar
           using BinaryTraits
           using BinaryTraits.Prefix: Is
           @trait Cute
           @implement Is{Cute} by awesome(_)
           struct Wat end
           @assign Wat with Is{Cute}
           testme() = @check Wat
       end

julia> Bar.testme()
┌ Warning: Missing implementation
│   contract = BinaryTrait{Main.Bar.Cute}: BinaryTraits.Prefix.Positive{Main.Bar.Cute} ⇢ awesome(🔹)
└ @ BinaryTraits ~/.julia/dev/BinaryTraits/src/interface.jl:62
❌ Main.Bar.Wat is missing these implementations:
1. BinaryTrait{Main.Bar.Cute}: BinaryTraits.Prefix.Positive{Main.Bar.Cute} ⇢ awesome(🔹) (Missing implementation)
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

No branches or pull requests

1 participant