Skip to content

Commit

Permalink
Add test for #38149
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 22, 2021
1 parent e37e290 commit 41353c8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -875,3 +875,18 @@ 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 = Base.method_instances(M.f, (Any, Any))
@test length(mis) == 2
@test any(mi -> mi.specTypes.parameters[2] === Any, mis)
@test all(mi -> isa(mi.cache, Core.CodeInstance), mis)
end

0 comments on commit 41353c8

Please sign in to comment.