JET.jl icon indicating copy to clipboard operation
JET.jl copied to clipboard

Catching undefined type variable

Open jtrakk opened this issue 4 years ago • 0 comments

https://github.com/JuliaLang/julia/issues/28674 explains it's possible to get undefined type variables.

Actually, prior to v0.7 we did make methods uncallable if we couldn't determine type variable values, but we found that too complicated since applicability had an extra condition aside from just subtyping.

Could JET catch this?

julia> g(x, y::Vararg{T}) where {T} = T
g (generic function with 1 method)

julia> g(1)
ERROR: UndefVarError: T not defined
Stacktrace:
 [1] g(::Int64)
   @ Main ./REPL[4]:1
 [2] top-level scope
   @ REPL[5]:1

julia> @code_typed g(1)
CodeInfo(
1 ─     return $(Expr(:static_parameter, 1))
) => Any

julia> @report_call g(1)
No errors !

jtrakk avatar Dec 06 '21 18:12 jtrakk