diff --git a/src/optimize.jl b/src/optimize.jl index 7a2dda2d..584822a8 100644 --- a/src/optimize.jl +++ b/src/optimize.jl @@ -372,19 +372,19 @@ end function replace_coretypes_list!(list::AbstractVector; rev::Bool) function rep(@nospecialize(x), rev::Bool) if rev - if isa(x, SSAValue) - return Core.SSAValue(x.id) - elseif isa(x, SlotNumber) - return Core.SlotNumber(x.id) + isa(x, SSAValue) && return Core.SSAValue(x.id) + isa(x, SlotNumber) && return Core.SlotNumber(x.id) + return x + else + isa(x, Core.SSAValue) && return SSAValue(x.id) + isa(x, Core.SlotNumber) && return SlotNumber(x.id) + @static if VERSION ≥ v"1.10.0-DEV.631" + isa(x, Core.TypedSlot) && return SlotNumber(x.id) + else + isa(x, Core.Compiler.TypedSlot) && return SlotNumber(x.id) end return x end - if isa(x, Core.SSAValue) - return SSAValue(x.id) - elseif isa(x, Core.SlotNumber) || isa(x, Core.TypedSlot) - return SlotNumber(x.id) - end - return x end for (i, stmt) in enumerate(list) diff --git a/test/interpret.jl b/test/interpret.jl index 41193255..06db61c9 100644 --- a/test/interpret.jl +++ b/test/interpret.jl @@ -307,7 +307,7 @@ let TT = Union{UInt8, Int8} end # issue #92 -let x = Core.TypedSlot(1, Any) +let x = Core.SlotNumber(1) f(x) = objectid(x) @test isa(@interpret(f(x)), UInt) end