Skip to content

Commit 9cad1e0

Browse files
authored
Add test for #38149 (#41958)
No code change is needed, but the use-case in that issue doesn't appear to be tested directly. Closes #38149
1 parent 6e1bae4 commit 9cad1e0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/precompile.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,3 +875,19 @@ precompile_test_harness("Renamed Imports") do load_path
875875
Base.compilecache(Base.PkgId("RenameImports"))
876876
@test (@eval (using RenameImports; RenameImports.test())) isa Module
877877
end
878+
879+
@testset "issue 38149" begin
880+
M = Module()
881+
@eval M begin
882+
@nospecialize
883+
f(x, y) = x + y
884+
f(x::Int, y) = 2x + y
885+
end
886+
precompile(M.f, (Int, Any))
887+
precompile(M.f, (AbstractFloat, Any))
888+
mis = map(methods(M.f)) do m
889+
m.specializations[1]
890+
end
891+
@test any(mi -> mi.specTypes.parameters[2] === Any, mis)
892+
@test all(mi -> isa(mi.cache, Core.CodeInstance), mis)
893+
end

0 commit comments

Comments
 (0)