aviatesk/JET.jl

`AssertionError`: `get_binding_type` should resolve the already-defined variable type

Drvi opened this issue · 1 comments

Drvi commented

Here is an innocent-looking code that triggers an assertion error:

julia> JET.report_text("""
       n=50
       rng = MersenneTwister(1)
       keys = rand(rng,n)
       """)
ERROR: AssertionError: `get_binding_type` should resolve the already-defined variable type

This is JET 0.8.21 with Julia 1.9.2. Here are some debug logs:

[toplevel-debug] virtualized the context of Main (took 0.007 sec)
[toplevel-debug] entered into top-level
[toplevel-debug] concretization plan at top-level:1:
1 f 1 ─ %1 = Core.get_binding_type(Main.var"##JETVirtualModule#292", :n)
2 f │   %2 = Base.convert(%1, 50)
3 f │   %3 = Core.typeassert(%2, %1)
4 f │        n = %3
5 f └──      return 50
[toplevel-debug] concretization plan at top-level:2:
1 f 1 ─ %1 = MersenneTwister(1)
2 f │   %2 = Core.get_binding_type(Main.var"##JETVirtualModule#292", :rng)
3 f │   %3 = Base.convert(%2, %1)
4 f │   %4 = Core.typeassert(%3, %2)
5 f │        rng = %4
6 f └──      return %1
[toplevel-debug] concretization plan at top-level:3:
1 f 1 ─ %1 = rand(rng, n)
2 f │   %2 = Core.get_binding_type(Main.var"##JETVirtualModule#292", :keys)
3 f │   %3 = Base.convert(%2, %1)
4 f │   %4 = Core.typeassert(%3, %2)
5 f │        keys = %4
6 f └──      return %1

Thank you for reporting this. Regrettably, this issue appears to not reproduce in versions 1.10 and later. Additionally, the newest version of JET has dropped support for v1.9, so it's unlikely that this issue will be addressed. I suggest upgrading to Julia version 1.10.