StaticLint.jl
StaticLint.jl copied to clipboard
False positive: Defining a new constructor causes a type to longer be understood as a type
Consider the following Julia code:
module M
struct MyNumber
sign::Bool
exponent::Int
mantissa::Int
end
function BigFloat(::MyNumber)
...
end
function cube_root(x::BigFloat)
...
end
end # module M
This yields blue squiggles under the definition of function cube_root(x::BigFloat)
with the following message:
A non-DataType has been used in a type declaration statement. Julia(InvalidTypeDeclaration)
Here, the presence of a new constructor BigFloat(::MyNumber)
has caused StaticLint to stop regarding BigFloat
as a type. This pattern occurs a few times in my package MultiFloats.jl.