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 MethodErrorReport Base.@kwdef with non used parameter #615

Open
dpinol opened this issue Feb 27, 2024 · 1 comment
Open

Comments

@dpinol
Copy link
Contributor

dpinol commented Feb 27, 2024

When creating a package with

module noConstructorFound

Base.@kwdef struct KWS{T}
    myField::Int
end
end

I get this error with julia 1.10 and JET 0.8.29

julia> r=report_package(noConstructorFound)
[toplevel-info] virtualized the context of Main (took 0.007 sec)
[toplevel-info] entered into /home/dani/dev/julia/jet/issues/noConstructorFound/src/noConstructorFound.jl
[toplevel-info]  exited from /home/dani/dev/julia/jet/issues/noConstructorFound/src/noConstructorFound.jl (took 0.32 sec)
[toplevel-info] analyzing from top-level definitions (7/7)
[toplevel-info] analyzed 7 top-level definitions (took 0.798 sec)
═════ 1 possible error found ═════
┌ noConstructorFound.KWS(; myField::Any) @ noConstructorFound /home/dani/dev/julia/jet/issues/noConstructorFound/src/noConstructorFound.jl:3
│ no matching method found `noConstructorFound.KWS(::Any)`: noConstructorFound.KWS(myField::Any)
└────────────────────

thanks

@dpinol
Copy link
Contributor Author

dpinol commented Feb 27, 2024

oth,

module noConstructorFound

Base.@kwdef struct KWS{T}
    myField::Union{T, Nothing} = nothing
end
end

causes

═════ 1 possible error found ═════
┌ noConstructorFound.KWS() @ noConstructorFound /home/dani/dev/julia/jet/issues/noConstructorFound/src/noConstructorFound.jl:3
│┌ noConstructorFound.KWS(; myField::Nothing) @ noConstructorFound /home/dani/dev/julia/jet/issues/noConstructorFound/src/noConstructorFound.jl:3
││┌ noConstructorFound.KWS(myField::Nothing) @ noConstructorFound /home/dani/dev/julia/jet/issues/noConstructorFound/src/noConstructorFound.jl:4
│││ `T` not defined in static parameter matching: Core.apply_type(noConstructorFound.KWS, T::Any)

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