Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reset
inTypeofContext
in generic instantiations (nim-lang#24229)
fixes nim-lang#24228, refs nim-lang#22022 As described in nim-lang#24228 (comment), instantiating generic routines inside `typeof` causes all code inside to be treated as being in a typeof context, and thus preventing compile time proc folding, causing issues when code is generated for the instantiated routine. Now, instantiated generic procs are treated as never being inside a `typeof` context. This is probably an arbitrary special case and more issues with the `typeof` behavior from nim-lang#22022 are likely. Ideally this behavior would be removed but it's necessary to accomodate the current [proc `declval` in the package `stew`](status-im/nim-stew#190), at least without changes to `compileTime` that would either break other code (making it not eagerly fold by default) or still require a change in stew (adding an option to disable the eager folding). Alternatively we could also make the eager folding opt-in only for generic compileTime procs so that nim-lang#22022 breaks nothing whatsoever, but a universal solution would be better. Edit: Done in nim-lang#24230 via experimental switch
- Loading branch information