Skip to content

Commit 593b9ac

Browse files
aviateskmlechu
andauthored
Remove test no longer relevant after nightly ccall change (#100)
The removed test attempted to pass a runtime-computed function name to `ccall` via `ccallable_sptest_name(T)`, but `ccall` now requires its function name argument to be a compile-time constant. This pattern only works with `@generated` functions from Julia 1.13 onwards, where the function name can be evaluated at code generation time. Currently JL cannot handle `@generated` functions, so the commenting out the test case updated in the last commit. --------- Co-authored-by: Em Chu <[email protected]>
1 parent 6b42c7a commit 593b9ac

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

test/misc.jl

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,21 @@ end
8787
@test test_mod.ccall_with_sparams(Int) === 1
8888
@test test_mod.ccall_with_sparams(Float64) === 1.0
8989

90-
# Test that ccall can be passed static parameters in the function name
91-
JuliaLowering.include_string(test_mod, raw"""
92-
# In principle, may add other strlen-like functions here for different string
93-
# types
94-
ccallable_sptest_name(::Type{String}) = :strlen
95-
96-
function ccall_with_sparams_in_name(s::T) where {T}
97-
ccall(ccallable_sptest_name(T), Csize_t, (Cstring,), s)
98-
end
99-
""")
100-
@test test_mod.ccall_with_sparams_in_name("hii") == 3
90+
# FIXME Currently JL cannot handle `@generated` functions, so the following test cases are commented out.
91+
# # Test that ccall can be passed static parameters in the function name
92+
# # Note that this only works with `@generated` functions from 1.13 onwards,
93+
# # where the function name can be evaluated at code generation time.
94+
# JuliaLowering.include_string(test_mod, raw"""
95+
# # In principle, may add other strlen-like functions here for different string
96+
# # types
97+
# ccallable_sptest_name(::Type{String}) = :strlen
98+
#
99+
# @generated function ccall_with_sparams_in_name(s::T) where {T}
100+
# name = QuoteNode(ccallable_sptest_name(T))
101+
# :(ccall($name, Csize_t, (Cstring,), s))
102+
# end
103+
# """)
104+
# @test test_mod.ccall_with_sparams_in_name("hii") == 3
101105

102106
@testset "CodeInfo: has_image_globalref" begin
103107
@test lower_str(test_mod, "x + y").args[1].has_image_globalref === false

0 commit comments

Comments
 (0)