Skip to content

Commit

Permalink
Fixes #385 (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
goerch authored Feb 22, 2022
1 parent d33cf59 commit d7fbc26
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ julia = "1.6"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
FunctionWrappers = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Mmap = "a63ad114-7e13-5084-954f-fe012c677804"
Expand All @@ -26,4 +27,4 @@ Tensors = "48a634ad-e948-5137-8d70-aa71f2a747f4"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["DataFrames", "Dates", "Distributed", "HTTP", "LinearAlgebra", "Mmap", "PyCall", "SHA", "SparseArrays", "Tensors", "Test"]
test = ["DataFrames", "Dates", "Distributed", "FunctionWrappers", "HTTP", "LinearAlgebra", "Mmap", "PyCall", "SHA", "SparseArrays", "Tensors", "Test"]
21 changes: 18 additions & 3 deletions src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,24 @@ function evaluate_foreigncall(@nospecialize(recurse), frame::Frame, call_expr::E
if !isempty(data.sparams) && scope isa Method
sig = scope.sig
args[2] = instantiate_type_in_env(args[2], sig, data.sparams)
args[3] = Core.svec(map(args[3]) do arg
instantiate_type_in_env(arg, sig, data.sparams)
end...)
@static if VERSION < v"1.7.0"
arg3 = args[3]
if arg3 isa Core.SimpleVector
args[3] = Core.svec(map(arg3) do arg
instantiate_type_in_env(arg, sig, data.sparams)
end...)
else
args[3] = instantiate_type_in_env(arg3, sig, data.sparams)
args[4] = Core.svec(map(args[4]::Core.SimpleVector) do arg
instantiate_type_in_env(arg, sig, data.sparams)
end...)
end
else
args[3] = instantiate_type_in_env(args[3], sig, data.sparams)
args[4] = Core.svec(map(args[4]::Core.SimpleVector) do arg
instantiate_type_in_env(arg, sig, data.sparams)
end...)
end
end
return Core.eval(moduleof(frame), Expr(head, args...))
end
Expand Down
5 changes: 5 additions & 0 deletions test/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,11 @@ module ForInclude end
@test JuliaInterpreter.finish_and_return!(Frame(ForInclude, ex), true) == 55
end

@testset "issue #385" begin
using FunctionWrappers:FunctionWrapper
@interpret FunctionWrapper{Int,Tuple{}}(()->42)
end

@testset "TypedSlots" begin
function foo(x, y)
z = x + y
Expand Down

0 comments on commit d7fbc26

Please sign in to comment.