@@ -64,7 +64,7 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f),
6464 end
6565 push! (infos, MethodMatchInfo (xapplicable, ambig))
6666 append! (applicable, xapplicable)
67- thisfullmatch = _any (match-> match[ 4 ] , xapplicable)
67+ thisfullmatch = _any (match-> ( match:: MethodMatch ) . fully_covers , xapplicable)
6868 found = false
6969 for (i, mt′) in enumerate (mts)
7070 if mt′ === mt
@@ -95,7 +95,7 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f),
9595 return CallMeta (Any, false )
9696 end
9797 push! (mts, mt)
98- push! (fullmatch, _any (match-> match[ 4 ] , applicable))
98+ push! (fullmatch, _any (match-> ( match:: MethodMatch ) . fully_covers , applicable))
9999 info = MethodMatchInfo (applicable, ambig)
100100 end
101101 update_valid_age! (min_valid[1 ], max_valid[1 ], sv)
@@ -109,17 +109,17 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f),
109109 istoplevel = sv. linfo. def isa Module
110110 multiple_matches = napplicable > 1
111111
112- if f != = nothing && napplicable == 1 && is_method_pure (applicable[1 ][ 3 ], applicable[ 1 ][ 1 ], applicable[ 1 ][ 2 ] )
112+ if f != = nothing && napplicable == 1 && is_method_pure (applicable[1 ]:: MethodMatch )
113113 val = pure_eval_call (f, argtypes)
114114 if val != = false
115115 return CallMeta (val, info)
116116 end
117117 end
118118
119119 for i in 1 : napplicable
120- match = applicable[i]:: SimpleVector
121- method = match[ 3 ] :: Method
122- sig = match[ 1 ]
120+ match = applicable[i]:: MethodMatch
121+ method = match. method
122+ sig = match. spec_types
123123 if istoplevel && ! isdispatchtuple (sig)
124124 # only infer concrete call sites in top-level expressions
125125 add_remark! (interp, sv, " Refusing to infer non-concrete call site in top-level expression" )
@@ -143,7 +143,7 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f),
143143 this_rt === Any && break
144144 end
145145 else
146- this_rt, edgecycle1, edge = abstract_call_method (interp, method, sig, match[ 2 ] :: SimpleVector , multiple_matches, sv)
146+ this_rt, edgecycle1, edge = abstract_call_method (interp, method, sig, match. sparams , multiple_matches, sv)
147147 edgecycle |= edgecycle1:: Bool
148148 if edge != = nothing
149149 push! (edges, edge)
@@ -167,7 +167,7 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f),
167167 # if there's a possibility we could constant-propagate a better result
168168 # (hopefully without doing too much work), try to do that now
169169 # TODO : it feels like this could be better integrated into abstract_call_method / typeinf_edge
170- const_rettype = abstract_call_method_with_const_args (interp, rettype, f, argtypes, applicable[nonbot]:: SimpleVector , sv, edgecycle)
170+ const_rettype = abstract_call_method_with_const_args (interp, rettype, f, argtypes, applicable[nonbot]:: MethodMatch , sv, edgecycle)
171171 if const_rettype ⊑ rettype
172172 # use the better result, if it's a refinement of rettype
173173 rettype = const_rettype
@@ -214,8 +214,8 @@ function const_prop_profitable(@nospecialize(arg))
214214 return false
215215end
216216
217- function abstract_call_method_with_const_args (interp:: AbstractInterpreter , @nospecialize (rettype), @nospecialize (f), argtypes:: Vector{Any} , match:: SimpleVector , sv:: InferenceState , edgecycle:: Bool )
218- method = match[ 3 ] :: Method
217+ function abstract_call_method_with_const_args (interp:: AbstractInterpreter , @nospecialize (rettype), @nospecialize (f), argtypes:: Vector{Any} , match:: MethodMatch , sv:: InferenceState , edgecycle:: Bool )
218+ method = match. method
219219 nargs:: Int = method. nargs
220220 method. isva && (nargs -= 1 )
221221 length (argtypes) >= nargs || return Any
@@ -261,9 +261,7 @@ function abstract_call_method_with_const_args(interp::AbstractInterpreter, @nosp
261261 if istopfunction (f, :getproperty ) || istopfunction (f, :setproperty! )
262262 force_inference = true
263263 end
264- sig = match[1 ]
265- sparams = match[2 ]:: SimpleVector
266- mi = specialize_method (method, sig, sparams, ! force_inference)
264+ mi = specialize_method (match, ! force_inference)
267265 mi === nothing && return Any
268266 mi = mi:: MethodInstance
269267 # decide if it's likely to be worthwhile
@@ -743,6 +741,7 @@ function is_method_pure(method::Method, @nospecialize(sig), sparams::SimpleVecto
743741 end
744742 return method. pure
745743end
744+ is_method_pure (match:: MethodMatch ) = is_method_pure (match. method, match. spec_types, match. sparams)
746745
747746function pure_eval_call (@nospecialize (f), argtypes:: Vector{Any} )
748747 for i = 2 : length (argtypes)
0 commit comments