Using an imported struct as a type annotation

As a rule, don’t include the same file multiple times.

You are including special.jl in three different places, so specialtype is being defined three times. This means you have three different types that all just happen to have the same name and structure, but are distinct from the type system’s point of view.

The right way to do this is to have everything inside one top level module, include your files once, and use relative imports to get what you need out of the top level.

4 Likes