Skip to content

Edits to function initially ignored, until unrelated edits happen #994

@topolarity

Description

@topolarity

Found on Revise v3.13.1 while developing JuliaLowering (commit b4da4fc3d4):

$ ./julia --project=JuliaLowering
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.14.0-DEV.1549 (2026-01-11)
 _/ |\__'_|_|_|\__'_|  |  Commit b4da4fc3d4* (0 days old master)
|__/                   |

julia> using Revise

julia> using JuliaLowering

Making an edit and running a test case does not show the expected println output:

shell> nvim  ~/repos/julia/JuliaLowering/src/closure_conversion.jl

shell> git --no-pager diff
diff --git i/JuliaLowering/src/closure_conversion.jl w/JuliaLowering/src/closure_conversion.jl
index c9951a7b24..3b44b0fa86 100644
--- i/JuliaLowering/src/closure_conversion.jl
+++ w/JuliaLowering/src/closure_conversion.jl
@@ -193,6 +193,7 @@ end
 # When doing this, the original value needs to be preserved, to ensure the
 # expression `a=b` always returns exactly `b`.
 function convert_assignment(ctx, ex)
+    println(stderr, "converted assignment.")
     var = ex[1]
     rhs0 = _convert_closures(ctx, ex[2])
     if kind(var) == K"Placeholder"

julia> JuliaLowering.include_string(Main, """
       function download()
           local response = 2
           foo() do output
               response = nothing
           end
       end
       """)
download (generic function with 1 method)
# assignment was never printed

This appears to be a Revise bug. Adding another edit will trigger the printing:

shell> nvim  ~/repos/julia/JuliaLowering/src/closure_conversion.jl

shell> git --no-pager diff
diff --git i/JuliaLowering/src/closure_conversion.jl w/JuliaLowering/src/closure_conversion.jl
index c9951a7b24..c5d9697d1d 100644
--- i/JuliaLowering/src/closure_conversion.jl
+++ w/JuliaLowering/src/closure_conversion.jl
@@ -193,6 +193,7 @@ end
 # When doing this, the original value needs to be preserved, to ensure the
 # expression `a=b` always returns exactly `b`.
 function convert_assignment(ctx, ex)
+    println(stderr, "converted assignment.")
     var = ex[1]
     rhs0 = _convert_closures(ctx, ex[2])
     if kind(var) == K"Placeholder"
@@ -343,6 +344,7 @@ function map_cl_convert(ctx::ClosureConversionCtx, ex, toplevel_preserving)
             ]
         end
     else
+        println(stderr, "mapchildren(...)")
         mapchildren(e->_convert_closures(ctx, e), ctx, ex)
     end
 end

julia> JuliaLowering.include_string(Main, """
       function download()
           local response = 2
           foo() do output
               response = nothing
           end
       end
       """)
mapchildren(...)
mapchildren(...)
converted assignment.
mapchildren(...)
mapchildren(...)
mapchildren(...)
mapchildren(...)
mapchildren(...)
converted assignment.
mapchildren(...)
mapchildren(...)
converted assignment.
mapchildren(...)
mapchildren(...)
mapchildren(...)
converted assignment.
mapchildren(...)
mapchildren(...)
mapchildren(...)
mapchildren(...)
converted assignment.
mapchildren(...)
mapchildren(...)
mapchildren(...)
download (generic function with 1 method)

and then deleting the additional edit preserves the expected printing:

shell> nvim  ~/repos/julia/JuliaLowering/src/closure_conversion.jl

shell> git --no-pager diff
diff --git i/JuliaLowering/src/closure_conversion.jl w/JuliaLowering/src/closure_conversion.jl
index c9951a7b24..3b44b0fa86 100644
--- i/JuliaLowering/src/closure_conversion.jl
+++ w/JuliaLowering/src/closure_conversion.jl
@@ -193,6 +193,7 @@ end
 # When doing this, the original value needs to be preserved, to ensure the
 # expression `a=b` always returns exactly `b`.
 function convert_assignment(ctx, ex)
+    println(stderr, "converted assignment.")
     var = ex[1]
     rhs0 = _convert_closures(ctx, ex[2])
     if kind(var) == K"Placeholder"

julia> JuliaLowering.include_string(Main, """
       function download()
           local response = 2
           foo() do output
               response = nothing
           end
       end
       """)
converted assignment.
converted assignment.
converted assignment.
converted assignment.
converted assignment.
download (generic function with 1 method)

Once this state is reached, I can make more edits to convert_assignment including deleted / re-adding the println statement and they all take effect as expected.

Manifest
(@v1.14) pkg> status -m
Status `~/.julia/environments/v1.14/Manifest.toml`
  [da1fd8a2] CodeTracking v3.0.0
  [807dbc54] Compiler v0.1.1
  [aa1ae85d] JuliaInterpreter v0.10.9
  [6f1432cf] LoweredCodeUtils v3.5.0
  [bac558e1] OrderedCollections v1.8.1
  [21216c6a] Preferences v1.5.1
  [295af30f] Revise v3.13.1
  [56f22d72] Artifacts v1.11.0
  [2a0f44e3] Base64 v1.11.0
  [ade2ca70] Dates v1.11.0
  [7b1f6079] FileWatching v1.11.0
  [b77e0a4c] InteractiveUtils v1.11.0
  [ac6e5ff7] JuliaSyntaxHighlighting v1.13.0
  [76f85450] LibGit2 v1.11.0
  [8f399da3] Libdl v1.11.0
  [d6f4376e] Markdown v1.11.0
  [ca575930] NetworkOptions v1.3.0
  [de0858da] Printf v1.11.0
  [3fa0cd96] REPL v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v1.0.0
  [6462fe0b] Sockets v1.11.0
  [f489334b] StyledStrings v1.13.0
  [fa267f1f] TOML v1.0.3
  [cf7118a7] UUIDs v1.11.0
  [4ec0a83e] Unicode v1.11.0
  [e66e0078] CompilerSupportLibraries_jll v1.3.0+1
  [e37daf67] LibGit2_jll v1.9.2+0
  [29816b5a] LibSSH2_jll v1.11.3+1
  [458c3c95] OpenSSL_jll v3.5.4+0
  [efcefdf7] PCRE2_jll v10.47.0+0
  [83775a58] Zlib_jll v1.3.1+2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions