Skip to content

Commit f904035

Browse files
committed
don't use inferred return type
1 parent 876b514 commit f904035

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/tapedfunction.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ struct ReturnInstruction{T} <: AbstractInstruction
2929
arg::TypedVar{T}
3030
end
3131

32-
mutable struct TapedFunction{F, T}
32+
mutable struct TapedFunction{F}
3333
func::F # maybe a function, a constructor, or a callable object
3434
arity::Int
3535
ir::Core.CodeInfo
3636
tape::RawTape
3737
unified_tape::Vector{FunctionWrapper{Nothing, Tuple{TapedFunction}}}
3838
counter::Int
3939
bindings::Dict{Symbol, Any}
40-
retval::TypedVar{T}
40+
retval::TypedVar{<:Any}
4141

4242
function TapedFunction(f::F, args...; cache=false) where {F}
4343
args_type = _accurate_typeof.(args)
@@ -55,17 +55,16 @@ mutable struct TapedFunction{F, T}
5555
utape = Vector{FunctionWrapper{Nothing, Tuple{TapedFunction}}}()
5656
bindings = translate!(tape, ir)
5757

58-
T = isa(ir.rettype, Core.Const) ? typeof(ir.rettype.val) : ir.rettype
59-
tf = new{F, T}(f, length(args), ir, tape, utape, 1,
60-
bindings, TypedVar{T}(:none))
58+
tf = new{F}(f, length(args), ir, tape, utape, 1,
59+
bindings, TypedVar{Any}(:none))
6160
TRCache[cache_key] = tf # set cache
6261
# unify!(tf)
6362
return tf
6463
end
6564

66-
function TapedFunction(tf::TapedFunction{F, T}) where {F, T}
67-
new{F, T}(tf.func, tf.arity, tf.ir, tf.tape, tf.unified_tape,
68-
tf.counter, tf.bindings, tf.retval)
65+
function TapedFunction(tf::TapedFunction{F}) where {F}
66+
new{F}(tf.func, tf.arity, tf.ir, tf.tape, tf.unified_tape,
67+
tf.counter, tf.bindings, TypedVar{Any}(:none))
6968
end
7069
end
7170

test/tapedtask.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
@test consume(ttask) == 2
1919
@test consume(ttask) == 3
2020

21-
# @inferred Libtask.TapedFunction(f)
21+
@inferred Libtask.TapedFunction(f)
2222
end
2323

2424
# Test case 2: heap allocated objects are shallowly copied.

0 commit comments

Comments
 (0)