FluxML / IRTools.jl

Mike's Little Intermediate Representation
MIT License
111 stars 35 forks source link

Fix evaluation with module in func() #85

Closed dfdx closed 1 year ago

dfdx commented 3 years ago

While trying to construct a function from IR in my package, I got an error:

Evaluation into the closed module Inner breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating Inner with eval during precompilation - don't do this.

After some investigation, I found out that IRTools.func(m, ir) takes module argument, but doesn't actually use it. This PR fixes it.

I wasn't able to reproduce this issue in tests In reasonable time to prevent future regressions, but I hope the change still makes sense.