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

False positive: accessing variables from other, possibly undefined modules

Open mbaz opened this issue 1 year ago • 1 comments

Consider code whose behavior depends on whether it is running on a notebook such as IJulia. Such a test is usually performed by inspecting a variable in the notebook's module. For example, IJulia's documentation recommends this code to test whether we're running in a notebook:

isdefined(Main, :IJulia) && Main.IJulia.inited

JET detects IJulia as not defined:

  ═════ 1 possible error found ═════
  ┌ @ /home/mbaz/rcs/jdev/Gaston/src/Gaston.jl:87 Main.IJulia
  │┌ @ Base.jl:31 Base.getglobal(x, f)
  ││ `IJulia` is not defined
  │└──────────────

However, in practice this will never be a problem, since the IJulia module is only accessed if it is defined.

mbaz avatar May 13 '23 18:05 mbaz

Yes, this false positive is very annoying. I will try to fix it sometime in this week.

aviatesk avatar May 21 '23 10:05 aviatesk