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

Warning related to SimpleTraits.jl #53

Closed
juliohm opened this issue Feb 27, 2021 · 3 comments · Fixed by #110
Closed

Warning related to SimpleTraits.jl #53

juliohm opened this issue Feb 27, 2021 · 3 comments · Fixed by #110
Labels
help wanted Extra attention is needed

Comments

@juliohm
Copy link
Member

juliohm commented Feb 27, 2021

Do you know what is happening here? How to fix this warning during precompilation?

julia> using Meshes
[ Info: Precompiling Meshes [eacbb407-ea5a-433e-ab97-5258b1ca43fa]
WARNING: Method definition _linear(D, Any) where {D} in module Meshes at /home/juliohm/.julia/packages/SimpleTraits/1wYi7/src/SimpleTraits.jl:331 overwritten on the same line (check for duplicate calls to `include`).
  ** incremental compilation may be fatally broken for this module **
@juliohm juliohm added the help wanted Extra attention is needed label Feb 27, 2021
@serenity4
Copy link
Member

I've never used SimpleTraits, but it looks like the dispatching bit IsGrid{D} is ignored or something (judging by the warning message). It's very strange though, because the _linear trait function you defined (snippet below taken from Meshes) matches the documented example very well.

@traitfn _linear(domain::D, inds) where {D; IsGrid{D}} =
  vec(LinearIndices(size(domain))[inds])
@traitfn _linear(::D, inds) where {D; !IsGrid{D}} = inds

It's a bit different from mauro3/SimpleTraits.jl#7, but maybe related?

@juliohm
Copy link
Member Author

juliohm commented Feb 27, 2021

I think it is the exact same issue. I asked there to see if he has a good fix in mind.

@lassepe
Copy link
Contributor

lassepe commented Mar 25, 2021

I am also seeing this warning. However, it seems to happen non-deterministically; or at least it may depend on the include order?

lassepe added a commit to lassepe/Meshes.jl that referenced this issue Apr 5, 2021
As per the comment in the SimpleTraits README, negated trait functions must use the same argument
names in order to avoid duplicate definitions:

  > Long story short: define the two methods of a trait and its negation using the same argument
  > names and no warning should be issued.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants