Skip to content

Commit d1fbf8d

Browse files
authored
key for storing compiled calls also needs to think about number of parameters (#324)
1 parent 02c51a3 commit d1fbf8d

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Mmap = "a63ad114-7e13-5084-954f-fe012c677804"
1919
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
2020
Tensors = "48a634ad-e948-5137-8d70-aa71f2a747f4"
2121
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
22+
TableReader = "70df011a-6618-58d7-8e16-3cf9e384cb47"
2223

2324
[targets]
24-
test = ["Test", "Dates", "Distributed", "Mmap", "SHA", "Tensors"]
25+
test = ["Test", "Dates", "Distributed", "Mmap", "SHA", "Tensors", "TableReader"]

src/optimize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ function build_compiled_call!(stmt, fcall, code, idx, nargs, sparams, evalmod)
287287
RetType = RetType[1]
288288
end
289289
# When the ccall is dynamic we pass the pointer as an argument so can reuse the function
290-
cc_key = (dynamic_ccall ? :ptr : cfunc, RetType, ArgType, evalmod) # compiled call key
290+
cc_key = (dynamic_ccall ? :ptr : cfunc, RetType, ArgType, evalmod, length(sparams)) # compiled call key
291291
f = get(compiled_calls, cc_key, nothing)
292292
argnames = Any[Symbol("arg", string(i)) for i = 1:nargs]
293293
if f === nothing

test/interpret.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,3 +562,13 @@ g(x) = f(x)
562562
@test (@interpret g(5)) == g(5)
563563
f(x) = x*x
564564
@test (@interpret g(5)) == g(5)
565+
566+
# Regression test https://github.com/JuliaDebug/JuliaInterpreter.jl/issues/300
567+
module CSVTest
568+
using Test
569+
using JuliaInterpreter
570+
using TableReader
571+
const myfile = "smallcsv.csv"
572+
@test (@interpret readcsv(myfile)) == readcsv(myfile)
573+
end
574+

test/smallcsv.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
a, b, c
2+
foo, 1.0, 2.3244342

0 commit comments

Comments
 (0)