Mysterious Subtyping

I have an abstract parent type PrimitiveBlock from package Yao.jl

In another package QuAlgorithmZoo.jl that depend on Yao.jl I defined a new type

struct QFTBlock{N} <: PrimitiveBlock{N,ComplexF64} end

Now I am using QuAlgorithmZoo like

using Yao
using Yao.Blocks
using QuAlgorithmZoo: QFTBlock

println(supertype(QFTBlock))

It will print Yao.Blocks.PrimitiveBlock{N,Complex{Float64}} where N just as expected.

But!

QFTBlock <: Yao.Blocks.PrimitiveBlock

will return false! why?

Note:

  • appear in both julia0.7 and julia1.0
  • I can not repeat this bug on another laptop.

It is related to keeping multiple version of same package Yao.jl, especially when developing multiple packages at the same time. Julia’s package loading is working in a wield way.