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

False positive: Defining a new constructor causes a type to longer be understood as a type #395

Open
dzhang314 opened this issue Sep 13, 2024 · 0 comments

Comments

@dzhang314
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant