diff --git a/base/Base.jl b/base/Base.jl index 10a8dd1532f92..8d836e164360e 100644 --- a/base/Base.jl +++ b/base/Base.jl @@ -198,7 +198,6 @@ function Core._hasmethod(@nospecialize(f), @nospecialize(t)) # this function has return Core._hasmethod(tt) end - # core operations & types include("promotion.jl") include("tuple.jl") diff --git a/base/compiler/stmtinfo.jl b/base/compiler/stmtinfo.jl index ceaf613a51ffc..692c7738eb2ce 100644 --- a/base/compiler/stmtinfo.jl +++ b/base/compiler/stmtinfo.jl @@ -178,9 +178,7 @@ add_uncovered_edges_impl(edges::Vector{Any}, info::ConstCallInfo, @nospecialize( """ info::MethodResultPure <: CallInfo -This struct represents a method result constant was proven to be -effect-free, including being no-throw (typically because the value was computed -by calling an `@pure` function). +This struct represents a method result constant was proven to be effect-free. """ struct MethodResultPure <: CallInfo info::CallInfo diff --git a/base/compiler/tfuncs.jl b/base/compiler/tfuncs.jl index fdafb3a9634ad..d544b5771f0af 100644 --- a/base/compiler/tfuncs.jl +++ b/base/compiler/tfuncs.jl @@ -2969,13 +2969,14 @@ end # a simplified model of abstract_call_gf_by_type for applicable function abstract_applicable(interp::AbstractInterpreter, argtypes::Vector{Any}, sv::AbsIntState, max_methods::Int) - length(argtypes) < 2 && return CallMeta(Bottom, Any, EFFECTS_THROWS, NoCallInfo()) - isvarargtype(argtypes[2]) && return CallMeta(Bool, Any, EFFECTS_THROWS, NoCallInfo()) + length(argtypes) < 2 && return CallMeta(Bottom, ArgumentError, EFFECTS_THROWS, NoCallInfo()) + isvarargtype(argtypes[2]) && return CallMeta(Bool, ArgumentError, EFFECTS_THROWS, NoCallInfo()) argtypes = argtypes[2:end] atype = argtypes_to_type(argtypes) matches = find_method_matches(interp, argtypes, atype; max_methods) if isa(matches, FailedMethodMatch) rt = Bool # too many matches to analyze + info = NoCallInfo() else (; valid_worlds, applicable) = matches update_valid_age!(sv, valid_worlds) @@ -2988,9 +2989,9 @@ function abstract_applicable(interp::AbstractInterpreter, argtypes::Vector{Any}, else rt = Const(true) # has applicable matches end - add_edges!(sv.edges, matches.info) + info = MethodResultPure(matches.info) # XXX this should probably be something like `VirtualizedCallInfo` end - return CallMeta(rt, Union{}, EFFECTS_TOTAL, NoCallInfo()) + return CallMeta(rt, Union{}, EFFECTS_TOTAL, info) end add_tfunc(applicable, 1, INT_INF, @nospecs((𝕃::AbstractLattice, f, args...)->Bool), 40) @@ -3024,15 +3025,14 @@ function _hasmethod_tfunc(interp::AbstractInterpreter, argtypes::Vector{Any}, sv update_valid_age!(sv, valid_worlds) if match === nothing rt = Const(false) - let vresults = MethodLookupResult(Any[], valid_worlds, true) - vinfo = MethodMatchInfo(vresults, mt, types, false) - add_edges!(sv.edges, vinfo) # XXX: this should actually be an invoke-type backedge - end + vresults = MethodLookupResult(Any[], valid_worlds, true) + vinfo = MethodMatchInfo(vresults, mt, types, false) # XXX: this should actually be an info with invoke-type edge else rt = Const(true) - add_edges!(sv.edges, InvokeCallInfo(match, nothing, types)) + vinfo = InvokeCallInfo(match, nothing, types) end - return CallMeta(rt, Any, EFFECTS_TOTAL, NoCallInfo()) + info = MethodResultPure(vinfo) # XXX this should probably be something like `VirtualizedCallInfo` + return CallMeta(rt, Union{}, EFFECTS_TOTAL, info) end # N.B.: typename maps type equivalence classes to a single value