Commit 21a0e25
committed
Fix a JET error regarding the existence of the local variable
* Fix a JET error regarding the existence of the local variable `reducer` at a certain point
```
┌ var"@distributed"(__source__::LineNumberNode, __module__::Module, args::Vararg{Any}) @ Distributed /workpath/Distributed.jl/src/macros.jl:363
│ local variable `reducer` may be undefined: reducer::Any
└────────────────────
```
By the time we get to this location in the code, we know that the local variable `reducer` exists, by the following reasoning. If the number of arguments is 1, then we have already returned before this point. If the number of arguments is neither 1 nor 2, then we have already thrown an exception by this point. Thus, if we reach this line, the number of arguments must be 2. Since the number of arguments is 2, we know that we executed the `reducer = args[1]` line above, which means that `reducer` is defined.
(cherry picked from commit cdb110658e0e3a89de3739b05679863fefb5b91b)
* Define `reducer = identity` in the `na==1` branch
(cherry picked from commit 1bc91f97a75c1ac321ed28dfca072cbabfad7b4c)reducer at a certain point (#169)1 parent 00321e8 commit 21a0e25
1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
| 336 | + | |
336 | 337 | | |
337 | 338 | | |
338 | 339 | | |
| |||
0 commit comments