julia
8399119a - [JuliaLowering] Implement static parameter capture (#62374)

Commit
62 days ago
[JuliaLowering] Implement static parameter capture (#62374) Static parameter capture is (as far as I know) the last non-trivial, non-performance piece of JuliaLowering that doesn't match flisp yet. I kind of understand why it was left unimplemented. This PR: - Don't do the flisp renaming-sparams-early step, since it just makes the hard parts of this harder. - Change the `method` form out of desugaring to be `(method argtype_svec lambda)` and fully construct the svec after its contents are known - Change the `method_defs` form to be `(method_defs id typevar_list body)`, because typevar_list should always precede lifted stuff in closure conversion, and because special resolution needs to happen when each `(typevar a b)` gets resolved (resolve b first, then declare a). - This is kind of a hack, but I didn't want deeply-nested scope blocks. These were previously declared as locals, which had the wrong scope resolution (they could all see each other), and this was a pkgeval problem. - Add new binding kind `:typevar`. This behaves like a local up until before linearization, and more like an ssavalue after that. - In scope resolution, we collect the mapping from static parameter to typevar, so that inner method signatures may resolve successfully (and even re-use the original typevar) This change also implements "underscore sparams are readable" #60626 and ports #57928 (sparam capture in opaque closure is more like capture of locals). It does not fix the pkgeval bug @topolarity reported to me with same- named functions that require different closure types. I've also added a cleaned-up Claude fix for typevars that depend on each other in their bounds. Not sure if it's the best way of doing this. There's an easy way out if this approach doesn't work (flisp just creates typevars `<:Any` in closures).
Author
Parents
Loading