Skip to content

Commit

Permalink
Add test for #38149 (#41958)
Browse files Browse the repository at this point in the history
No code change is needed, but the use-case in that issue doesn't
appear to be tested directly.

Closes #38149
  • Loading branch information
timholy committed Aug 23, 2021
1 parent 6e1bae4 commit 9cad1e0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -875,3 +875,19 @@ precompile_test_harness("Renamed Imports") do load_path
Base.compilecache(Base.PkgId("RenameImports"))
@test (@eval (using RenameImports; RenameImports.test())) isa Module
end

@testset "issue 38149" begin
M = Module()
@eval M begin
@nospecialize
f(x, y) = x + y
f(x::Int, y) = 2x + y
end
precompile(M.f, (Int, Any))
precompile(M.f, (AbstractFloat, Any))
mis = map(methods(M.f)) do m
m.specializations[1]
end
@test any(mi -> mi.specTypes.parameters[2] === Any, mis)
@test all(mi -> isa(mi.cache, Core.CodeInstance), mis)
end

0 comments on commit 9cad1e0

Please sign in to comment.