A type from the same library passed via different paths is not considered identical

I’ve encountered a strange situation while setting up CI for one of my projects. I have a package LogProof that uses another package, DarkIntegers. DarkIntegers is in the Julia registry, LogProof isn’t.

LogProof tests fail for julia-1.0 in CI, while the same tests for 1.2 and 1.3 pass. The reason, essentially, is the following:

  • a DarkIntegers.Polynomial object is created by a function in LogProof
  • a function from DarkIntegers is called with this object in the test script
  • despite the function having a method specialized on the type Polynomial, the call fails

The fail is buried in the broadcasting machinery, but if one just calls some straightforward function from DarkIntegers acting on Polynomial objects, the result is the same - a method fails to be resolved.

This only happens if one uses a Polynomial object created by a function in LogProof; an object created in the test itself works fine. This only happens in Julia 1.0 (both in CI and on my local machine), not in 1.2 or 1.3. It doesn’t seem to happen in my other analogous projects which also use DarkIntegers. I thought that maybe I specified dependencies incorrectly, so LogProof uses a different copy of DarkIntegers as compared to the test script, but then it wouldn’t happen in CI, would it?

So, does anyone have any ideas about how to diagnose this?

1 Like

Are you loading the same files with include multiple times? That can cause two separate copies of all of the same functions and types to be created which don’t know about each other.

2 Likes

Nope, pretty sure I don’t. The file with the type in question is included once inside DarkIntegers.jl, and then DarkIntegers is connected via using in the test script.

Huh, I did some more digging and apparently the fail in CI was caused by a different issue after all; the problem on my local machine was solved by clearing out the environment and reinstalling everything (not sure what was causing it exactly). Sorry for the confusion.

2 Likes