julia icon indicating copy to clipboard operation
julia copied to clipboard

Code warntype should show print the unstable SSA values in red/yellow

Open gbaraldi opened this issue 1 year ago • 4 comments

If you have some code like

julia> function foo(x)
       y = x[1]
       sin(y)
       end
foo (generic function with 1 method)

julia> code_warntype(foo, (Vector{Any},), optimize=true)
image

It would be useful if %17 was printed in red

gbaraldi avatar Apr 10 '24 18:04 gbaraldi

I don't know the consequences of directly interpolating expression here but here is the first attempt at it. Any guiding information on coverage of IR statements in code changes made will be appreciated.

Screenshot 2024-04-29 at 12 45 15 AM

arhik avatar Apr 28 '24 19:04 arhik

@gbaraldi Should line 19 be highlighted too ?

arhik avatar Apr 28 '24 19:04 arhik

IMO, only the IR statement would have the red color, similar to how currently only ::Any is red %17 would be red as well. The whole line being red doesn't show the user what specifically is type unstable in that statement

gbaraldi avatar Apr 29 '24 15:04 gbaraldi

Screenshot 2024-05-17 at 8 16 09 AM

arhik avatar May 17 '24 02:05 arhik

I was checking a good first issue to start with, and I think this is solved already. Am I right?

joseeloren avatar Aug 02 '24 17:08 joseeloren

@joseeloren Its partially solved and need tests. Also, I have commits on my local setup. I am struggling to make time, and I don't recollect if I have it all resolved. If you don't see any commits from me by coming weekend it's all yours.

In case you end up taking this up, the existing code is good enough for adding tests directly (I think it doesn't cover few node types yet and that can be next PR or next set of commits after passing tests for commits made so far).

arhik avatar Aug 02 '24 18:08 arhik