aviatesk / JET.jl

An experimental code analyzer for Julia. No need for additional type annotations.

Home Page:https://aviatesk.github.io/JET.jl/dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

false positive MethodErrorReport Base.@kwdef with non used parameter

dpinol opened this issue · comments

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

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)