Skip to content

Commit 95e32aa

Browse files
KDr2yebaidevmotion
authored
Fix #161 (#162)
* Fix #161 * TypedSlot is in Core.Compiler in Julia v1.10 * Update src/Libtask.jl Co-authored-by: David Widmann <[email protected]> * Update Project.toml --------- Co-authored-by: Hong Ge <[email protected]> Co-authored-by: David Widmann <[email protected]>
1 parent 73c5fe6 commit 95e32aa

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

Diff for: Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ uuid = "6f1fad26-d15e-5dc8-ae53-837a1d7b8c9f"
33
license = "MIT"
44
desc = "Tape based task copying in Turing"
55
repo = "https://github.com/TuringLang/Libtask.jl.git"
6-
version = "0.8.5"
6+
version = "0.8.6"
77

88
[deps]
99
FunctionWrappers = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e"

Diff for: src/Libtask.jl

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ export TapedTask, consume, produce
77

88
export TArray, tzeros, tfill, TRef # legacy types back compat
99

10+
11+
const TypedSlot = @static if isdefined(Core, :TypedSlot) # Julia v1.10 removed Core.TypedSlot
12+
Core.TypedSlot
13+
else
14+
Core.Compiler.TypedSlot
15+
end
16+
1017
include("tapedfunction.jl")
1118
include("tapedtask.jl")
1219

Diff for: src/tapedfunction.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ function bind_var!(var::QuoteNode, bindings::Bindings, ir::Core.CodeInfo)
285285
LOGGING[] && @info "evaluating QuoteNode $var at compile time"
286286
bind_var!(eval(var), bindings, ir)
287287
end
288-
function bind_var!(var::Core.TypedSlot, bindings::Bindings, ir::Core.CodeInfo)
288+
function bind_var!(var::TypedSlot, bindings::Bindings, ir::Core.CodeInfo)
289289
# turn TypedSlot to SlotNumber
290290
bind_var!(Core.SlotNumber(var.id), bindings, ir)
291291
end
@@ -295,9 +295,9 @@ end
295295
function bind_var!(var::Core.SSAValue, bindings::Bindings, ir::Core.CodeInfo)
296296
get!(bindings[1], var, allocate_binding!(var, bindings, ir.ssavaluetypes[var.id]))
297297
end
298-
299298
allocate_binding!(var, bindings::Bindings, c::Core.Const) =
300-
allocate_binding!(var, bindings, _loose_type(Type{c.val}))
299+
allocate_binding!(var, bindings, _loose_type(Type{_accurate_typeof(c.val)}))
300+
301301
allocate_binding!(var, bindings::Bindings, c::Core.PartialStruct) =
302302
allocate_binding!(var, bindings, _loose_type(c.typ))
303303
function allocate_binding!(var, bindings::Bindings, ::Type{T}) where T
@@ -378,7 +378,7 @@ function translate!!(var::IRVar, line::NTuple{N, Symbol},
378378
return Instruction(func, input, output)
379379
end
380380

381-
function translate!!(var::IRVar, line::Core.TypedSlot,
381+
function translate!!(var::IRVar, line::TypedSlot,
382382
bindings::Bindings, isconst::Bool, ir)
383383
input_box = bind_var!(Core.SlotNumber(line.id), bindings, ir)
384384
return Instruction(identity, (input_box,), bind_var!(var, bindings, ir))

0 commit comments

Comments
 (0)