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 negative

nsajko opened this issue · comments

@report_call says that "no errors" are detected, but the call deterministically throws UndefVarError.

julia> f_vararg(t::Vararg{Type{<:T}}) where {T} = T
f_vararg (generic function with 1 method)

julia> using JET

julia> @report_call f_vararg(Int, String)
No errors detected


julia> @report_opt f_vararg(Int, String)
No errors detected


julia> f_vararg(Int, String)
ERROR: UndefVarError: `T` not defined in static parameter matching
Suggestion: run Test.detect_unbound_args to detect method arguments that do not fully constrain a type parameter.
Stacktrace:
 [1] f_vararg(::Type{Int64}, ::Vararg{Type{<:Union{Int64, String}}})
   @ Main ./REPL[1]:1
 [2] top-level scope
   @ REPL[5]:1

julia> versioninfo()
Julia Version 1.11.0-DEV.1167
Commit e8f89682d7* (2023-12-29 05:33 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
  WORD_SIZE: 64
  LLVM: libLLVM-15.0.7 (ORCJIT, znver2)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
Environment:
  JULIA_NUM_PRECOMPILE_TASKS = 3
  JULIA_PKG_PRECOMPILE_AUTO = 0

(@v1.11) pkg> st JET
Status `~/.julia/environments/v1.11/Project.toml`
  [c3a54625] JET v0.8.22

Maybe the fact that the f_vararg(Int, String) throws could be a Julia bug, but JET is supposed to flag it anyway, I hope.

Fixed in JET@0.8.23.